JSLint错误:“将调用移动到包含函数的括号中” [英] JSLint error: "Move the invocation into the parens that contain the function"
问题描述
JSLint 是什么意思?
错误:第78行的问题3:将调用移动到包含函数的括号中:
})(jQuery);
要传递JSLint的标准,需要这样写: / p>
}(jQuery));
认为特定的标准有点主观。这两种方式在我看来都很好。
(function(){})()
因为你包装完整的函数,然后调用它
(function(){}())
就像你将函数调用的结果包裹在括号...中。
What does JSLint mean by this error? And how should it be rewritten?
Error: Problem at line 78 character 3: Move the invocation into the parens that contain the function:
})(jQuery);
To pass JSLint's criteria, it needs to be written like this:
}(jQuery));
Though I think that particular criteria is a bit subjective. Both ways seem fine in my opinion.
(function () {})()
makes a bit more sense to me since you wrap the full function, then call it
(function () {}())
looks like you're wrapping the result of the function call in a parens ...
这篇关于JSLint错误:“将调用移动到包含函数的括号中”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!