[英]Why does JSLint give strict violation error on this function?
JSLint gives me the "strict violation" error, although I use the "this" context inside a function which hides it from the global scope. JSLint给出了“严格违规”错误,尽管我在一个隐藏全局范围的函数中使用了“this”上下文。
function test() {
"use strict";
this.a = "b";
}
For the record, I use the built-in JSLint parser in Webstorm. 为了记录,我在Webstorm中使用内置的JSLint解析器。
This is because JSLint doesn't recognize your function as a constructor. 这是因为JSLint无法将您的函数识别为构造函数。 By convention, you must use uppercase letters. 按照惯例,您必须使用大写字母。
function Test() {
"use strict";
this.a = "b";
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.