function getName() {
console.log(this.name);
}
const alice = { name: 'Alice' };
const bob = { name: 'Bob' };
const boundAlice = getName.bind(alice);
boundAlice();
boundAlice.call(bob);function getName() {
console.log(this.name);
}
const alice = { name: 'Alice' };
const bob = { name: 'Bob' };
const boundAlice = getName.bind(alice);
boundAlice();
getName.call(bob);Bug: bind permanently fixes this. .call(bob) cannot override a bound function — it still runs with alice as this.
Explanation: To use bob's context, call the original unbound function with .call(bob) — not the bound version.
Key Insight: bind() creates a permanently bound function. call/apply cannot override it. Keep a reference to the original if you need different contexts.