call() vs apply(): what's the difference?
By FrontendPro Editorial Team Updated 9/26/2026
Answer
Both invoke a function with a this you choose. The only difference is how the remaining arguments arrive: call takes them one by one, apply takes them as one array.
function greet(greeting, punctuation) {
return greeting + ', ' + this.name + punctuation;
}
const user = { name: 'Mai' };
greet.call(user, 'Hello', '!'); // one by one
greet.apply(user, ['Hello', '!']); // as an array
Remember it as apply goes with array.
When the array form earns its keep
When you already have an array and do not know its length:
Math.max.apply(null, numbers); // Math.max takes separate arguments
Spread syntax now covers this, so Math.max(...numbers) is the modern answer and apply mostly shows up in older code.
And bind
call and apply invoke immediately. bind invokes nothing — it returns a new function with this locked in, which is what you want for a callback:
const boundGreet = greet.bind(user, 'Hi');
setTimeout(boundGreet, 0); // '!' can still be passed later
Two caveats
In strict mode a null or undefined first argument stays as-is; outside strict mode it is replaced by the global object. And none of the three affect an arrow function, which has no this of its own — passing one is silently ignored.
