DEV Community

Rating Rai
Rating Rai

Posted on

The this Keyword in JavaScript 🀯

The this Keyword in JavaScript 🀯
πŸ”Ή What is this?
The this keyword refers to the object that is currently executing the function. Its value depends on how and where a function is called.

πŸ”Ή Different Cases of this:

Image description
βœ… Key Takeaways:
βœ” this behaves differently in arrow functions
βœ” Depends on the calling context
βœ” In strict mode ("use strict"), this in the global scope is undefined

πŸ”₯ Challenge: Can you explain the difference between this in an arrow function vs a regular function? Let's discuss in the comments!

JavaScript #100DaysOfJavaScript #ThisKeyword #Coding

Top comments (0)