this
🚧 under construction
Last updated
Was this helpful?
🚧 under construction
Last updated
Was this helpful?
⟩ ⟩ ⟩ ⟩ "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❗️
arrow functions don’t have “own” this, it’s taken from the "outer context" .
the body of a class has a this context.
replit:
itHome ⟩ ⟩
- bind "this" context and return a new function.
- call a function with "this" context and indivisual arguments.
- call a functin with "this" context and arguments array.
問:「如何利用 定義一個新的屬性,它的值是一個物件、具有物件方法,然後在此方法內參照原物件(要定義新屬性的物件)」❓