Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
以下行:
var A = function def() {alert();};
只有 A() 调用该函数。def() 没有。为什么会这样?左边不是函数声明吗?
在函数表达式中,函数名主要用于自调用。IRL 这个特性在匿名函数和递归调用的情况下很方便,即
(function def() { // ... def(); })();