JSLint gives me the "strict violation" error, although I use the "this" context inside a function which hides it from the global scope.
function test() {
"use strict";
this.a = "b";
}
For the record, I use the built-in JSLint parser in Webstorm.
JSLint gives me the "strict violation" error, although I use the "this" context inside a function which hides it from the global scope.
function test() {
"use strict";
this.a = "b";
}
For the record, I use the built-in JSLint parser in Webstorm.
Share Improve this question edited Jul 22, 2013 at 9:49 Erik Bergstedt asked Jul 21, 2013 at 7:28 Erik BergstedtErik Bergstedt 91210 silver badges27 bronze badges 3- When I paste this code into JSLint., all default options, I do not receive an error. What was the context of the error where changing the function name removed it? – ruffin Commented Jul 22, 2013 at 3:45
- I'm using Webstorm which maybe has an outdated version of JSLint – Erik Bergstedt Commented Jul 22, 2013 at 9:33
-
Any chance you have two functions named (the equivalent of)
test
(in your live code)? Then changing case would make them different. – ruffin Commented Jul 22, 2013 at 16:12
1 Answer
Reset to default 10This is because JSLint doesn't recognize your function as a constructor. By convention, you must use uppercase letters.
function Test() {
"use strict";
this.a = "b";
}