What do call, apply and bind do, and how are they different from each other?
Show the explanation
Model answer. All three let you choose the value of this for a function.
- `fn.call(thisArg, a, b)` calls the function now, with arguments listed one by one.
- `fn.apply(thisArg, [a, b])` calls it now, with arguments as an array.
- `fn.bind(thisArg, a)` does not call it; it returns a new function with
this(and optionally leading arguments) fixed permanently.
function intro(greeting, punct) { return `${greeting}, I am ${this.name}${punct}`; }
const asha = { name: 'Asha' };
intro.call(asha, 'Hi', '!'); // 'Hi, I am Asha!'
intro.apply(asha, ['Hello', '.']); // 'Hello, I am Asha.'
const hiAsha = intro.bind(asha, 'Hey');
hiAsha('?'); // 'Hey, I am Asha?'Typical uses: bind for passing a method as a callback without losing this (button.addEventListener('click', obj.handle.bind(obj))); apply was common for spreading arrays before spread syntax existed. Binding an arrow function has no effect on its this.
Original UniCircle question. Last reviewed 22 Oct 2026.
