JavaScript this Keyword Behavior Depends on Function Invocation

🧠 Day 12 of 21days challenge JavaScript "this" keyword 🤯 const user1 = { name: "Shubham" } const user2 = { name: "Rahul" } Same function. Different outputs. Why? Because "this" is not defined where the function is written. It is decided when the function is called. For easy understanding :- this = caller object Determined at runtime Depends on how function is invoked 👉 That’s why the same function behaves differently This changed how I understand function execution 🚀 #JavaScript #ThisKeyword #InterviewPrep #Frontend

  • text

To view or add a comment, sign in

Explore content categories