JSLint错误:“将调用移动到包含函数的括号中” [英] JSLint error: "Move the invocation into the parens that contain the function"

查看:1021
本文介绍了JSLint错误:“将调用移动到包含函数的括号中”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆