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)