JavaScript Function call() Method

Beginner
6 min read
Updated: Nov 2026
3 examples
Instance method

Definition

call() runs a function right now and lets you choose what this means inside it. You pass the value for this first, then the normal arguments one by one, separated by commas.

It returns whatever the function returns. You will use it to run one function for different objects, or to borrow a method from another object that does not have it.

Remember
func.call(thisArg, arg1, arg2, ...);

thisArg  → what "this" is inside func
arg1...  → the arguments, one by one
returns  → whatever func returns

call() runs the function immediately.

Syntax

Call call() on any function. The first argument is the value for this; everything after it is passed to the function.

JavaScript
func.call(thisArg);
func.call(thisArg, arg1, arg2, argN);
CallWhat it does
greet.call(user)Run greet with this set to user.
greet.call(user, "Hello", "!")Same, and also pass the arguments "Hello" and "!" one by one.
Math.max.call(null, 4, 9, 2)Pass null when the function does not use this. The result is 9.

Built into JavaScript (ES3). Every function has it; no import required. Siblings: apply(), bind() and toString().

Library declarations
JavaScript
// Function.prototype.call (ES3)
func.call()
func.call(thisArg)
func.call(thisArg, arg1, arg2, /* ..., */ argN)

// returns whatever func returns

Parameters

ParameterDescription
thisArgOptional. The value that this has inside the function. In strict mode it is used exactly as you pass it. In normal (non-strict) code, null and undefined are replaced by the global object, and text or numbers are wrapped in an object. An arrow function ignores it.
arg1, arg2, ..., argNOptional. The arguments for the function, given one by one in the same order as the function's own parameters.

Return Value

Return ValueDescription
The function's resultWhatever the function returns is returned by call().
undefinedThe function has no return statement.
An error from the functionIf the function throws, the error passes through call() unchanged.

JavaScript Examples

Example 1 — Run One Function for Different Objects

The introduce() function reads this.name. With call() the same function can speak for two different people.

JavaScript
function introduce(greeting, punctuation) {
  return greeting + ", I am " + this.name + punctuation;
}

const alice = { name: "Alice" };
const bob = { name: "Bob" };

console.log(introduce.call(alice, "Hello", "!"));
console.log(introduce.call(bob, "Hi", "."));
console.log(typeof introduce.call(alice, "Hey", "?"));
Try It Yourself

How It Works

  1. One function. introduce() uses this.name, so its result depends on what this is.
  2. Pick this and pass arguments. introduce.call(alice, "Hello", "!") sets this to alice, then passes "Hello" and "!" as the two parameters. The second call does the same for bob.
  3. It returns the result. call() gives back what the function returned, so typeof reports "string".

Example 2 — Borrow an Array Method for an Array-Like Object

The object below looks like an array (numbered keys and a length), but it is not one. call() lets it use array methods anyway.

JavaScript
const letters = { 0: "a", 1: "b", 2: "c", length: 3 };

console.log("Is it an array? " + Array.isArray(letters));
console.log("Has map? " + (typeof letters.map));

const upper = Array.prototype.map.call(letters, (letter) => letter.toUpperCase());
console.log(upper.join("-"));

console.log(Array.prototype.join.call(letters, "+"));
Try It Yourself

How It Works

  1. Not a real array. letters has no map() method of its own, so letters.map(...) would fail.
  2. Borrow the method. Array.prototype.map.call(letters, ...) runs the array's map() with this set to letters. It reads the numbered keys and the length, so it works.
  3. Use it again. The same trick works for join(). The results are normal arrays and text, even though the source object was not an array.

Example 3 — See That Arrow Functions Ignore call()

A regular function follows the this you give it. An arrow function keeps the this from the place where it was created.

JavaScript
const teamA = {
  name: "Team A",
  regular: function () {
    return this.name;
  },
  makeArrow() {
    return () => this.name;
  }
};

const teamB = { name: "Team B" };
const arrow = teamA.makeArrow();

console.log(teamA.regular());
console.log(teamA.regular.call(teamB));
console.log(arrow());
console.log(arrow.call(teamB));
Try It Yourself

How It Works

  1. Regular function. teamA.regular() uses teamA as this. With call(teamB), the same function now sees teamB.
  2. Arrow function. makeArrow() returns an arrow function. It was created while this was teamA, so it remembers teamA.
  3. call() has no effect on it. Both arrow() and arrow.call(teamB) print "Team A". That is why you should not use arrow functions for methods that rely on call().

Browser & Runtime Support

call() is one of the oldest JavaScript features. Every browser and every Node.js version supports it.

✓ ES3 · Works everywhere

func.call()

Supported in all browsers, including old ones, and in Node.js, Deno and Bun.

ES3 Standard since
Google Chrome All versions · Desktop & Mobile
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Opera All versions
Full support
Samsung Internet All versions · Android
Full support
Android WebView All versions
Full support
Node.js All versions · Server runtime
Supported
Deno All versions · JavaScript runtime
Supported
Bun All versions · JavaScript runtime
Supported
Internet Explorer All versions
Full support
func.call() Excellent

Bottom line: You can use call() anywhere. The only thing that changes between old and new code is the strict-mode rule for null and undefined as thisArg.

Frequently Asked Questions

It runs a function immediately, with the value you choose as this and with the arguments you list after it. It returns whatever the function returns. It is a method of every function, so you write it as myFunction.call(thisValue, arg1, arg2).
They do the same job. The only difference is how you pass the arguments: call() takes them one by one (fn.call(obj, 1, 2, 3)), while apply() takes them in one array (fn.apply(obj, [1, 2, 3])).
Pass null (or undefined). The function never reads this, so it does not matter. Math.max.call(null, 4, 9, 2) is a common example. In older non-strict code, null becomes the global object, which is harmless here.
An arrow function does not have its own this. It uses the this of the place where it was written. call(), apply() and bind() can pass arguments to an arrow function, but they cannot change its this.
call() runs the function now. bind() does not run it; it returns a new function with this already fixed, which you can call later, for example as an event handler or timer callback.

Next: toString()

Learn how to turn a function into text and read its source code.

toString() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

14 people found this page helpful