What is the this Keyword in JavaScript?

What is the this Keyword in JavaScript?

Ferenc Almasi • 2020 November 12 • 📖 1 min read

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
Did you find this page helpful?
📚 More Webtips
Frontend Course Dashboard
Master the Art of Frontend
  • check Unlimited access to hundred of tutorials
  • check Access to exclusive interactive lessons
  • check Remove ads to learn without distractions
Become a Pro