📘this
🚧 under construction
JS ⟩ execution context ⟩ lexical environment ⟩ environment record ⟩ "this"
Within the body of a method, "this" evaluates to the object on which the method was invoked.
property of an execution context.
the object “before dot” (the one who calls the method).
"this" determined on call site❗️ (runtime), not by function declaration (compile-time).
but there are exceptions, 👉 see:arrow function arrow function as class field❗️
this
is not fixed in a method.
is passed (at runtime) by the function call. 👉 method binding.
The value of this in a normal function is by default:
arrow functions don’t have “own” this, it’s taken from the "outer context" .
the body of a class has a this context.
the value of this is stored in environment record.
Last updated