---
title: "What is the difference between call, apply, and bind methods in JavaScript?"  
description: "What is the difference between call, apply, and bind methods in JavaScript?"  
author: "Steilla Mitchel"  
published: 2024-06-25  
updated: 2024-06-25  
canonical: https://www.mindstick.com/forum/160784/what-is-the-difference-between-call-apply-and-bind-methods-in-javascript  
category: "javascript"  
tags: ["javascript", "javascript object", "javascript method"]  
reading_time: 3 minutes  

---

# What is the difference between call, apply, and bind methods in JavaScript?

What is the [difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) between call, [apply](https://www.mindstick.com/articles/13148/discover-to-apply-make-up-like-a-professional-supermodel), and bind [methods](https://www.mindstick.com/articles/13060/runny-nose-remedy-methods-that-work-best) in JavaScript?

## Replies

### Reply by Ashutosh Patel

#### JavaScript call, apply, and bind Methods

In JavaScript, calls, implementations, and bindings are methods for modifying the context (this keyword) in which the operation is performed.

Each has specific usage and grammatical differences.

#### call() Method

The `call` method invokes the function given `this` values ​​and one by one with the given arguments.

## Syntax-

```javascript
func.call(thisArg, arg1, arg2, ...)
```

## Example-

```javascript
function greet(greeting, punctuation) {
 console.log(greeting + ', ' + this.name + punctuation);
}
const person = { name: 'Alice' };
greet.call(person, 'Hello', '!'); // Output: "Hello, Alice!"
```

#### apply() Method

The `apply()` method calls a function that is given `this` value, but the argument is given as an array (or array-like object).

## Syntax-

```javascript
func.apply(thisArg, [argsArray])
```

## Example-

```javascript
function greet(greeting, punctuation) {
 console.log(greeting + ', ' + this.name + punctuation);
}
const person = { name: 'Alice' };
greet.apply(person, ['Hello', '!']); // Output: "Hello, Alice!"
```

#### bind() Method

The `Bind` method creates a new function that, when called, has `this` value set to the provided value, with a given sequence of arguments preceding any provided when the new function is called. Unlike `call` and `apply`, `bind` does not invoke the function immediately; it returns a new function.

## Syntax-

```javascript
const boundFunction = func.bind(thisArg, arg1, arg2, ...)
```

## Example-

```javascript
function greet(greeting, punctuation) {
 console.log(greeting + ', ' + this.name + punctuation);
}
const person = { name: 'Alice' };
const boundGreet = greet.bind(person, 'Hello');
boundGreet('!'); // Output: "Hello, Alice!"
```

#### The main differences

## Invocation

- **call-** Immediately call the function with the individual arguments.
- **apply-** Immediately call the function with arguments given as an array.
- **bind-** Returns a new function, which can be called later with any arguments.

## Syntax

- **call-** The arguments are listed one by one.
- **apply-** The arguments are passed as an array.
- **bind-** Creates a new function with default arguments.

## Use Case

- Use `call` when you know the level of dispute and want to call the function immediately.
- Use `apply` when you have an array of arguments and you want to call the function immediately.
- Use `bind` when you want to create a new function with that particular `this` value and/or with default arguments, to call later.

Understanding these methods and their differences is important for proper implementation and context management in JavaScript.

**Also, Read:** [What is JavaScript's spread operator (...), and how is it used?](https://www.mindstick.com/forum/160760/what-is-javascript-s-spread-operator-and-how-is-it-used)


---

Original Source: https://www.mindstick.com/forum/160784/what-is-the-difference-between-call-apply-and-bind-methods-in-javascript

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
