What is the this Keyword in JavaScript?
The “this
” keyword in JavaScript refers to the object it belongs to. By default in the browser, it refers to the global object which is the window
.
Keep in mind that if it is used inside an arrow function, it refers to the enclosing scope as arrow functions don’t bind their own context. Also, note that if a function is called with bind
or call
, this
will refer to the context passed in as the first parameter.
If you are interested in reading more about the this
keyword, or you would like to see some practical examples, make sure to check out the article below.
Rocket Launch Your Career
Speed up your learning progress with our mentorship program. Join as a mentee to unlock the full potential of Webtips and get a personalized learning experience by experts to master the following frontend technologies: