javascript - JSLint错误的解决方案

标签 javascript jslint

我已经开始使用 JSLint。我检查了我的代码,但出现了以下错误:

Problem at line 92 character 7: Move the invocation into the parens that contain the function.
})();

Problem at line 92 character 7: Wrap the entire immediate function invocation in parens.
})();

如何解决这个错误?

最佳答案

我相信这意味着您应该将函数调用括号移到包装括号内

(function() { /* code */ })() 

执行函数的最后两个括号是问题所在。这是 jslint 希望它看起来像的样子:

(function() { /* code */ }()) 

关于javascript - JSLint错误的解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1450721/

相关文章:

javascript - 如何使用 'this' 变量检索*不*调用函数的元素的 id

javascript - 为什么 jslint 提示我的空间?

javascript - 将 @author 的使用视为代码风格违规

php - 在哪里可以找到用 PHP 编写的 JSLint/js 验证解析器?

javascript - 选择选择 angularjs 中的第一个选项

javascript - 如何在叠加层上放置标记

.net - 如何让 JSLint.VS Addin 与 Visual Studio 2010 一起使用?

javascript - 从 Firefox 浏览器扩展触发事件?

javascript - 故障的CSS文件

javascript - 在 JAVASCRIPT 模块模式中定义私有(private)字段成员和继承