JavaScript Strict mode: run under strict conditions
How to: Add ' use strict ' command browser support at top of JavaScript (Internet Explore + +, Firefox 4+, Chrome 13+, Safari 5.1+, Opera 12+)
What are the benefits of strict mode?
1, improve the situation of error;
2, improve the compiler efficiency, increase the speed of the operation;
3. Pave the new version of JavaScript for the future.
What are the restrictions imposed by strict mode?
A) do not allow the use of variables declared
b) Deleting a variable or object is not allowed (the object is also a variable)
c) Delete function is not allowed
d) do not allow variable names
e) Do not allow the use of octal
f) The use of escape characters is not allowed
g) do not allow values to be assigned to read-only properties
h) does not allow assignment of properties read by a getter () method
i) do not allow deleting a property that is not allowed to be deleted
j) Variable names cannot use the "eval" string
k) Variable name cannot use "arguments" string
L) with (Math) {x = cos (2)}; Error
m) prohibit the This keyword from pointing to global objects
JavaScript Strict mode (ECMASCRIPT5 new)