JSLint 错误:“将调用移动到包含该函数的括号中" [英] JSLint error: "Move the invocation into the parens that contain the function"
本文介绍了JSLint 错误:“将调用移动到包含该函数的括号中"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
JSLint 这个错误是什么意思?又该如何改写?
What does JSLint mean by this error? And how should it be rewritten?
错误:第 78 行字符 3 处的问题:将调用移动到包含函数的括号中:})(jQuery);
推荐答案
要通过JSLint的标准,需要这样写:
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 () {})()
对我来说更有意义,因为你包装了完整的函数,然后调用它
(function () {})()
makes a bit more sense to me since you wrap the full function, then call it
(function () {}())
看起来您将函数调用的结果包装在括号中...
(function () {}())
looks like you're wrapping the result of the function call in a parens ...
这篇关于JSLint 错误:“将调用移动到包含该函数的括号中"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文