Turn strict mode on/off explicitly (in ES5)
WHEN (global) code starts with "use strict" THEN strict mode is turned on for the whole file/module
WHEN eval code starts with "use strict" THEN the executed code is run in strict mode
WHEN a function starts with "use strict" THEN the code inside of it is run in strict mode
WHEN the code passed to
new Function() starts with "use strict" THEN the code is run in strict mode
The MDN docs about strict mode.
Chapter 4.2.2 in the specification explains that and why ECMAScript offers a "strict mode" to restrict language features, and that it can coexist with non-strict code in the same program.
Chapter 10.1.1 in the specification explains how to turn strict mode on and off.
Appendix C "The strict mode restriction and exceptions" explains the differences between strict mode and non-strict mode in detail.