JavaScript Use Strict
Info Strict Mode |
w3 Strict |
MDN Strict |
Stack Overflow Strict |
Plain English Strict
Conclusion
The strict mode makes it easier to write “secure” JavaScript. It changes previously accepted “bad
syntax” into real errors. For example, in regular, JavaScript, mistyping the variable name creates the new global
variable. In strict mode, it results in error, making it impossible to create the global variable accidentally.
In standard JavaScript, the developer will not receive any error feedback assigning values to the
non-writable properties. In strict mode, any assignment to the non-writable property, a getter-only property, a
non-existing property, the non-existing variable, or the non-existing object, will throw an error.
Keywords reserved for future JavaScript versions cannot be used as the variable names in strict mode.
Those keywords are the following : implements, interface, let, package, private, protected, public, static, yield.
In case we are using browser console to test any feature, by default strict mode is not enforced. We
need to add manually by using ‘use strict’.