❗arrow function as class field❗️
🚧 under construction
Last updated
Was this helpful?
🚧 under construction
Last updated
Was this helpful?
Was this helpful?
JS ⟩ objects ⟩ arrow function ⟩ as class field
arrow function as class field closes over the class's this context.
the this inside the arrow function's body:
will correctly point to the instance (or the class itself, for static fields).
it is a closure, not the function's own binding, the value of will not change based on the execution context (call site)❗
👉 MDN ⟩ arrow functions used as methods ⭐️