JavaScript Strict mode (use strict)
JavaScript rigorous mode (strict mode) is run under strict conditions.
Using the "Use strict" directive
The "Use strict" directive was added in JavaScript 1.8.5 (ECMASCRIPT5).
It is not a statement, but it is a literal expression that is ignored in older versions of JavaScript.
The purpose of the "use strict" is to specify that the code executes under strict conditions.
You cannot use undeclared variables in strict mode. A browser that supports strict mode:
Internet Explorer 10 +, Firefox 4+ Chrome 13+, Safari 5.1+, Opera 12+.
Strict Mode declaration
Strict mode adds "use strict" to the head of a script or function; An expression to declare.
Why use Strict mode:
eliminate some unreasonable and unreasonable JavaScript grammar, reduce some strange behavior;
- To eliminate some of the unsafe code operation, to ensure the security of code operation;
- Improve compiler efficiency, increase running speed;
- Pave the future for new versions of JavaScript.
"Strict mode" embodies JavaScript more reasonable, more secure, more rigorous development direction, including IE 10 mainstream browser, has supported it, many large projects have begun to embrace it fully.
On the other hand, the same code, in "Strict mode", may have different running results; some statements that can be run under normal mode will not work in strict mode. Mastering these elements will help you understand JavaScript more carefully and make you a better programmer.
JavaScript Form Validation
HTML form validation can be done through JavaScript.
Java Script Learning 4 (RPM)