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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay