1//It's a new feature of ECMAScript 5.
2//With strict mode, you can not, for example, use undeclared variables.
3
4Insert a 'use strict'; statement on top of your script:
5/***START ANY JS FILE***/
6'use strict';
7var a = 2;
8....
9/***END***/
10Or, insert a 'use strict'; statement on top of your function body:
11
12function doSomething() {
13 'use strict';
14 ...
15}
1// Whole-Script Strict Mode Syntax
2'use strict';
3var v = "Hi! I'm a strict mode script!";
1// Non-strict code...
2
3(function(){
4 "use strict";
5
6 // Define your library strictly...
7})();
8
9// Non-strict code...