Anonymous invocation
suggest changeA 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
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents