【发布时间】:2015-02-05 14:48:40
【问题描述】:
我见过大量的 javascript 代码使用自执行函数,例如:
(function(){
// ... code here
})();
但偶尔,我看到人们这样做:
(function(){
// ... code here
}).call(this);
这两种形式在功能上有区别吗?如果有,是什么?
第二种形式的例子:https://github.com/shawnmclean/Idle.js/blob/master/build/idle.js#L160
【问题讨论】:
标签: javascript