strict
mode against recommended approach JS-0118 11 })
12 : t(e)
13})(typeof window !== 'undefined' ? window : this, function (C, e) {
14 'use strict' 15 function x (e) {
16 return e != null && e === e.window
17 }
1!(function (e, t) {
2 'use strict' 3 typeof module === 'object' && typeof module.exports === 'object'
4 ? (module.exports = e.document
5 ? t(e, !0)
A strict mode directive is a "use strict"
literal at the beginning of a script or function body. It enables strict mode semantics.
When a directive occurs in global scope, strict mode applies to the entire script:
"use strict";
// strict mode
function foo() {
// strict mode
}
When a directive occurs at the beginning of a function body, strict mode applies only to that function, including all contained functions:
function foo() {
"use strict";
// strict mode
}
function foo2() {
// not strict mode
};
(function() {
"use strict";
function bar() {
// strict mode
}
}());
In the CommonJS module system, a hidden function wraps each module and limits the scope of a "global" strict mode directive.
In ECMAScript modules, which always have strict mode semantics, the directives are unnecessary.
function foo() {
}
function foo() {
"use strict";
}
"use strict";
function foo() {
"use strict";
}
function foo() {
}