Aryan PrajapatKnowledge Contributor
What do you mean by the ‘this’ keyword in JavaScript?
What do you mean by the ‘this’ keyword in JavaScript?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Questions | Answers | Discussions | Knowledge sharing | Communities & more.
In the case of Java, the ‘This’ keyword is used to point to the current object, but in JavaScript, the ‘This’ keyword refers to them from where it was called.
In other Words, we could say that the” this” keyword refers to the object it belongs to.
So, the ‘this’ keyword has different values according to or depending upon where it is used.
1.If we use it in a method then, this refers to the owner object.
2.If it is alone, then this refers to the Global object.
3.If it is used in a function, then this refers to the global object
4.If it is used in a function, in strict mode, then this remains undefined.
5.In an event, this refers to that respective element that receives the event.
Call() and apply() method refer ‘this’ to any object.