他们一定将 IIFE 与“自调用函数”混淆了。
这是本·阿尔曼(Ben Alman)写的:
“自执行匿名函数”有什么问题?</p>
您已经多次看到它提到过,但如果不清楚,我建议使用术语“立即调用函数表达式”,如果您喜欢首字母缩略词,则建议使用“IIFE”。向我建议了发音“iffy”,我喜欢它,所以让我们一起去吧。
什么是立即调用函数表达式?这是一个立即调用的函数表达式。就像名字会让你相信一样。
我希望看到 JavaScript 社区成员在他们的文章和演示文稿中采用术语“立即调用函数表达式”和“IIFE”,因为我觉得它使理解这个概念更容易一些,并且因为术语“自执行匿名函数”甚至都不准确:
// This is a self-executing function. It's a function that executes (or
// invokes) itself, recursively:
function foo() { foo(); }
// This is a self-executing anonymous function. Because it has no
// identifier, it must use the the `arguments.callee` property (which
// specifies the currently executing function) to execute itself.
var foo = function() { arguments.callee(); };
// This *might* be a self-executing anonymous function, but only while the
// `foo` identifier actually references it. If you were to change `foo` to
// something else, you'd have a "used-to-self-execute" anonymous function.
var foo = function() { foo(); };
// Some people call this a "self-executing anonymous function" even though
// it's not self-executing, because it doesn't invoke itself. It is
// immediately invoked, however.
(function(){ /* code */ }());
// Adding an identifier to a function expression (thus creating a named
// function expression) can be extremely helpful when debugging. Once named,
// however, the function is no longer anonymous.
(function foo(){ /* code */ }());
// IIFEs can also be self-executing, although this is, perhaps, not the most
// useful pattern.
(function(){ arguments.callee(); }());
(function foo(){ foo(); }());
// One last thing to note: this will cause an error in BlackBerry 5, because
// inside a named function expression, that name is undefined. Awesome, huh?
(function foo(){ foo(); }());
资料来源:http ://benalman.com/news/2010/11/immediately-invoked-function-expression/