Call
Function.prototype.call is a JavaScript method that invokes a function with a specified this value and arguments supplied individually.
Secrets of the JavaScript Ninja, Second Edition
A JavaScript Function method that invokes a function with an explicit this value and arguments supplied individually.
- How it is used
- Controls a function’s execution context and supplies its arguments individually, including during callback invocation.
- How deep it goes
- Demonstrates explicit contexts through function calls and callbacks, contrasting positional arguments with apply’s array.
- Examples
- Uses a juggle function to set object results and a forEach callback to make each item its context.
- What you can do after
- Apply call to choose a callback’s this value and pass its arguments individually.
Read how Secrets of the JavaScript Ninja, Second Edition explains call →
Secrets of the JavaScript Ninja, Third Edition
A JavaScript method that invokes a function with an explicitly supplied this value and individual arguments.
- How it is used
- Invokes a function with an explicitly chosen context, including when borrowing a method for another object.
- How deep it goes
- Defines the context-first syntax and individual argument list, contrasting call with apply without detailing implementation internals.
- Examples
- Demonstrates a sum function writing results to two objects and contrasts individual call arguments with apply’s array.
- What you can do after
- Apply call to invoke a function with a chosen context and individually supplied arguments.
Read how Secrets of the JavaScript Ninja, Third Edition explains call →
Also covered in
- Essential TypeScript 5, Third Edition
- JavaScript in DepthIn early access (MEAP)
What to know first
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- new keywordIn JavaScript, new is an operator that creates an object instance by invoking a constructable function or class as its constructor.
- strict modeStrict mode is a JavaScript execution mode that applies stricter parsing and runtime rules and restricts or reports certain error-prone behaviors.
- thisIn JavaScript, the this value is determined by a function’s call context or, for an arrow function, inherited lexically.
Related concepts
- applycontrasts with · Function.prototype.apply is a JavaScript method that invokes a function with a specified this value and arguments supplied as an array or array-like object.
- thisconfigures · In JavaScript, the this value is determined by a function’s call context or, for an arrow function, inherited lexically.
- array methodused by · A JavaScript array method is a built-in operation associated with arrays for inspecting, processing, or transforming their elements.
- arrow functioncontrasts with · An arrow function is a JavaScript function expression written with arrow syntax that uses lexical binding for this and has no own arguments object.
- constructor methoduses · A constructor method is a type-associated operation involved in creating an instance and establishing its initial state.
Questions about call
What is call?
Function.prototype.call is a JavaScript method that invokes a function with a specified this value and arguments supplied individually.
Which Manning books explain call?
Secrets of the JavaScript Ninja, Second Edition and Secrets of the JavaScript Ninja, Third Edition.
What should I know before learning call?
Manning books that teach call usually introduce function, new keyword, strict mode and this first.
What is the difference between call and apply?
Function.prototype.call is a JavaScript method that invokes a function with a specified this value and arguments supplied individually. Function.prototype.apply is a JavaScript method that invokes a function with a specified this value and arguments supplied as an array or array-like object.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

