The "use strict"; directive was introduced in ECMAScript version 5. It is not
a statement, but a literal expression, ignored by earlier versions of JavaScript. The
purpose of strict mode is to indicate that the code should be executed in
"strict mode".
Strict mode is declared by adding "use strict"; to the beginning of a script
or a function.
"use strict";
x = 3.14; // Error: x is not defined
x = 3.14; // Allowed
function myFunc() {
"use strict";
y = 3.14; // Error: y not defined
}
let or var).Strict mode makes it impossible to perform certain actions that would otherwise be allowed in "sloppy mode":
x = 3.14;delete x;function x(p1, p1) {};let x = 010;"use strict"; must be at the very top of its scopethis keyword is undefined in global
functions