Difference between call, apply, and bind in JavaScript

Learn how call, apply, and bind control the "this" context and pass arguments to functions dynamically.

intermediateIntermediate conceptsjavascriptthisfunctions
Published: Nov 3, 2025

Question

What’s the difference between call, apply, and bind in JavaScript?


Answer

All three explicitly set the value of this for a function.

const user = { name: 'Ghazi' };
function greet(greeting) {
  console.log(`${greeting}, ${this.name}`);
}

greet.call(user, 'Hello');
greet.apply(user, ['Hi']);
const bound = greet.bind(user);
bound('Hey');
  • call(): calls the function immediately, with arguments separated by commas.
  • apply(): same as call, but arguments are passed as an array.
  • bind(): returns a new function with a permanently bound this.

Real-World Example

In event listeners or callbacks, bind ensures your function retains its intended context.

Quick Practice

Create a function that logs a message using this.name and test it with all three methods.

Summary

Use call and apply to invoke immediately, bind to remember context.

Related Videos
Watch these videos to learn more about this topic
Frequently Asked Questions

Do call, apply, and bind permanently change "this"?

Only bind() returns a new function with "this" permanently set. call() and apply() invoke immediately.

Advertisement


Stay Updated

Get the latest frontend challenges, interview questions and tutorials delivered to your inbox.

Advertisement