Different between (function(){})() and (function(){}()) , self invoking anonymous function [duplicate]

馋奶兔 提交于 2019-12-02 19:57:10

问题


Look at the placement of the parenthesis, is that any different?

( func )( )

(function(){

})();

and ( func( ) )

(function(){

}());

回答1:


Technically the first defines an anonymous function, then calls it, the second defines an anonymous function which calls itself as it's defined. Realistically, they are identical.



来源:https://stackoverflow.com/questions/23625005/different-between-function-and-function-self-invoking-anonymou

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!