I have added the following line as the FIRST line in my javascript file:
'use strict';
My understanding was that by adding this as the first line, ALL code following is placed in a "strict" operating context-- which makes sense...
However, I run JSLint and it reports 71 warnings, i.e.:
[JSLint] Recommendation: Expected 'use strict' before 'var'. Visit https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode for more information.
Basically, it looks like it wants to see 'use strict'; in every function??
So, what is the purpose of including "use strict" in the first line if (according to JSLint), every function in the file needs it?
Let's just change the syntax of all javascript statements look something like:
"use strict"; for ( var i = 0; i < 1000; i++ ) {
"use strict"; console.log( 'this is dumb' );
"use strict"; }
Why is this directive needed in nearly every function?
I am at a loss.
I've read the marked duplicate JSLint is suddenly reporting: Use the function form of "use strict" and do not believe this is a duplicate of that question.
According to everything I have read and what I have read in the marked duplicate -- the directive should apply to EVERY line of code in the file -- can someone please explain why this is NOT the case when using JSLint?