문제

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.

도움이 되었습니까?

해결책

This 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";
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top