We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
一般会看到在这样的模块下会在之前加上一个分号或者加号
;(function() { // code });
之所以这样是因为在代码块压缩的时候不加分号可能会出现问题,比如:
// dev var a = 0 (function() {})(); // uglify var a=0 (function(){})(); // error
所以在IIFE前加上一个分号作为语句结束的分隔符,这是一个好的习惯,在bootstrap的一些插件中也使用+在IIFE之前。
+
由于js有ASI(自动分号插入),在语句后是否应该加分号也是一个比较开放的话题,但是最好有一个统一约定。更多讨论查看https://www.zhihu.com/question/20298345
The text was updated successfully, but these errors were encountered:
No branches or pull requests
一般会看到在这样的模块下会在之前加上一个分号或者加号
之所以这样是因为在代码块压缩的时候不加分号可能会出现问题,比如:
所以在IIFE前加上一个分号作为语句结束的分隔符,这是一个好的习惯,在bootstrap的一些插件中也使用
+
在IIFE之前。由于js有ASI(自动分号插入),在语句后是否应该加分号也是一个比较开放的话题,但是最好有一个统一约定。更多讨论查看https://www.zhihu.com/question/20298345
The text was updated successfully, but these errors were encountered: