;(function ( $, window, document, undefined )
在jquery插件中我们经常看到以下这段代码
;(function ( $, window, document, undefined ){
//函数体内具体代码
})(jQuery, window,document);
对于很多初学者来说很难明白这表示什么,我也是初学者,不是很懂,下边为大家介绍其相应的作用。
1、代码最前面的分号,可以防止多个文件压缩合并以为其他文件最后一行语句没加分号,而引起合并后的语法错误。
2、匿名函数(function(){})();由于Javascript执行表达式是从圆括号里面
转载
2020-10-09 19:45:45 ·
259 阅读 ·
0 评论