❗"this" determined on call site❗️
(usually) "this" is determined on run-time
Last updated
Was this helpful?
(usually) "this" is determined on run-time
Last updated
Was this helpful?
Was this helpful?
JS ⟩ object ⟩ "this" ⟩ determined on call site
(usually) the value of this is:
not by function/method declaration (compile-time)
but there are exceptions, 👉 see:arrow function arrow function as class field❗️
💾 replit:this determined on call site
// object
let user = {
name: "Joe",
sayHi() {
console.log(`Hi, I am ${this.name}.`);