Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

Function.prototype.call — invoke a function with an explicit this

Function.prototype.call immediately invokes a function with an explicit this value and individually supplied arguments. Learn how strict mode affects this and why arrow functions and bound functions ignore the supplied receiver.

Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support

Syntax

fn.call(thisArg, ...args)

Function.prototype.call invokes a function fn using fn.call(thisArg, ...args). The first argument specifies this; the remaining arguments are passed to the function's parameters in order. The method returns the function's result and propagates any exception it throws. In the example, the same function reads name from two different objects.

The method itself passes thisArg without conversion. An ordinary strict-mode function preserves that value, including null, undefined, and primitives. In non-strict mode, null and undefined are replaced with the global this value, and other primitives are wrapped in objects.

call cannot override an arrow function's lexical this or the fixed this of a function bound with bind. Unlike apply, it accepts arguments individually; bind creates a function instead of invoking it immediately. Using Function.prototype.call with a non-callable receiver throws TypeError.

Examples

function describe(prefix, suffix) {
  "use strict";
  return prefix + this.name + suffix;
}

const person = { name: "Ada" };
console.log(describe.call(person, "Hello, ", "!"));
console.log(describe.call({ name: "Lin" }, "Hi, ", "."));

Result

Hello, Ada!
Hi, Lin.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources