<分区>
Possible Duplicate:
Location of parenthesis for auto-executing anonymous JavaScript functions?
问题是重复的 Location of parenthesis for auto-executing anonymous JavaScript functions? 和 What do parentheses surrounding a object/function/class declaration mean?
真的很好奇,这段代码中括号的用途是什么:
(function() {})();
这看起来我可以很容易地写成:
var x=function(){};
(x)();
使用 jQuery 插件,我们会做类似的事情......
(function($) {})(jQuery);
括号是怎么回事?