If you label JavaScript and ANGULARJS code as "strict mode," all of the code running in it must be in strict mode.
One: If a syntax problem is found during syntax detection, the entire block of code is invalidated and a syntax exception is caused.
Second: If code that violates strict mode occurs during run time, an execution exception is thrown.
Note: Strict mode is not supported for tested ie6,7,8,9.
How to use the "strict mode" JavaScript code:
Strict mode requires the use of string sequences:
"Use Strict"
You can open the strict mode in the corresponding code block by adding the following:
1. You must join at the beginning of the global code.
2. Add at the beginning of the eval code.
3. Add at the beginning of the function declaration code.
4. The body parameter block passed in the new Function () begins to join.
Example 1:
var num =012;alert (num);
In non-strict mode, you can declare 8 binary with the prefix 0 (0). Display 10.
However, in strict mode, errors are generated.
"Use strict";
var num = 012;
alert (num);
Test results:
ie6,7,8,9 are shown in 10.
FF Error: Octal literals and octal escape sequences are deprecated
Chrome Error: uncaught syntaxerror:octal literals is not allowed in strict mode.
Opera error: Syntax error at line 3 while loading:invalid character var num = 012;
If you use strict mode, in addition to the 0 (0) prefix 8 binary, there are:
1. You cannot use some extended reserved words in your code:
Implements,interface,let,package,private,public,static,yield
2.with statements are also not available.
3. Eval and arguments two identifiers cannot be declared or overridden.
4. You cannot remove an explicitly declared identifier, name, or named function with delete.
JavaScript and ANGULARJS syntax support strict mode: "Use strict"