Use Strict is a feature of ECMASCRIPT5 and is not recommended to be used globally, because when you compress different files, a file uses the use strict, a file that is not used, and does not use strict will be error-free.
1. Role
Eliminate the problem that JS syntax is unreasonable, not rigorous, unsafe, improve compiler efficiency, increase running speed
2. Supported Browsers
Ie10+,firefox4+,safari12+,opera12+,chrome
3. Rules
Variable:
Create global variable eg:name = "Bella" is not allowed;
You cannot delete a variable eg:var name = "Bella"; Delete name;
Object:
Cannot assign a value to a read-only property:
ECMAscript5 appeared the Object.definepropotype method changed the JavaScript language in which all object is public;
Object.definepropotype (obj,prop,descriptor): objects that need to be added or modified, property names, property descriptions;
var person = {name: ' Bella ', Sex: ' Female '};object.definepropotype (person, ' name ', {value: ' Alias ', Writable:false})
You cannot use the delete operation for a non-configurable property
Not configurable is also set by Object.definepropotype.
var person = {name: ' Bella ', Sex: ' Female '};object.definepropotype (person, ' name ', {configurable:false})
Function:
Parameter must be unique Eg:function (a,a) {}
Modifying a parameter does not affect arguments eg:funtion (arg1) {arg1 = "Bella";} Arguments[0]:bella,arguments was modified in non-strict mode
Use of Arguments.callee and Arguments.caller is not allowed
Eval () is not allowed to create a variable or function in the containing context
Eval is rarely used, because Eval executes the string as a JS code, changing the context Eg:eval ("var x = 10"); Alert (x) This is not allowed
This is not allowed to be null or undefined
Using with statements is not allowed
Octal literals are not allowed
JS Strict mode