What is the this Keyword in JavaScript?

What is the this Keyword in JavaScript?

Ferenc Almasi • 2020 November 12 • Read time 1 min read
  • twitter
  • facebook
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.

The global object in the browser

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 callthis will refer to the context passed in as the first parameter.

What is the this Keyword in JavaScript?
If you would like to see more Webtips, follow @flowforfrank

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.

What Is “this”, After All? — A Look at JavaScript this Keyword
  • twitter
  • facebook
JavaScript
Did you find this page helpful?
📚 More Webtips
Mentoring

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:

Courses

Recommended

This site uses cookies We use cookies to understand visitors and create a better experience for you. By clicking on "Accept", you accept its use. To find out more, please see our privacy policy.