liveBook · Manning

Call

As explained in Secrets of the JavaScript Ninja, Second Edition

The act of executing a function through a function invocation mechanism.

JavaScript functions can be invoked in different ways, and the invocation form affects the function’s implicit this context. section 4.1.2 section 4.2

The four invocation forms are:

A plain function call

Calling ninja() gives this the global window object in nonstrict mode; calling strict-mode samurai() gives this the value undefined. section 4.2.1

How Secrets of the JavaScript Ninja, Second Edition covers it

How deep it goes
Distinguishes four invocation forms and their effects on this, detailing ordinary function calls with a strict-mode comparison.
Examples
Demonstrates ninja() and strict samurai() returning window and undefined, alongside method, constructor, call, and apply forms.
What you can do after
Understand how invocation form changes this, including ordinary calls in strict and nonstrict mode.
How it connects
Connects invocation to this, method calls, constructors, call, apply, strict mode, arrow functions, and bind.

Also explained in

Compare how 7 books explain call →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Secrets of the JavaScript Ninja, Second Edition. The section links point to the parts of the book it draws on.