const person = {
name: 'Alice',
greet() { console.log('Hello, ' + this.name); },
};
const greet = person.greet;
greet();const person = {
name: 'Alice',
greet() { console.log('Hello, ' + this.name); },
};
const greet = person.greet.bind(person);
greet();Bug: Assigning the method to a variable detaches it from the object. When called as a plain function, this is undefined — not person.
Explanation: bind(person) permanently ties this to person regardless of how greet is later called.
Key Insight: this is determined by the call site, not the definition site. Bind when storing a method as a variable.