Anonymous invocation

suggest change

A bare call, rather than a method call, is sometimes called an anonymous invocation. In non-strict code, this is the global object (window in a browser page).

function func() {
    return this;
}

func() === window; // true, in a non-strict browser script

In strict mode, a bare call sets this to undefined. The directive has to be inside the called function. A strict caller does not make a non-strict callee strict.

function func() {
    "use strict";
    return this;
}

func(); // undefined

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents