可能是重复问题:
在JavaScript中,“(function ( ) { } ) ( )”和“(function ( ) { } ( ) )”在功能上等效吗?
我正在阅读下面的文档。
http://addyosmani.com/resources/essentialjsdesignpatterns/book/#patternity
当我查看这些示例时,匿名函数的自调用有三种形式。
其中一种是
(function() {
//do something
})();
另一个是
function() {
//do something
}();
另外一个是
(function() {
//do something
}());
这三种形式有什么不同?
感谢您的阅读!