"03"
Strict mode
ECMAScript 5introduced a strict mode (Strict Mode) concept. The strict mode is forJavaScripta different parsing and execution model is defined. In strict mode,ECMAScript 3Some of the uncertainties in the behavior will be handled, and some unsafe operations will throw an error. To enable strict mode throughout the script, you can add the following code at the top:
"use strict";
This line of code looks like a string, and it's not assigned to any variable, but it's actually a compilation instruction ( pragma ), to tell the supported JavaScript the engine switches to strict mode. This is a specially selected syntax for not destroying the ECMAScript 3 syntax.
Include this compilation instruction above the function, or you can specify that the function is executed in strict mode:
 
- < Code class= "Language-c" >function dosomething () {
"use strict" ;
//function body
}
under strict mode,JavaScriptthe results of the implementation will vary greatly. Browsers that support strict mode includeie10+,Firefox 4+,Safari 5.1+,Opera 12+and theChrome.
What is JS strict mode?