在节点中closures范围
在一个快速的应用程序,我能够做到这一点
function donothing() { } donothing()
但不是这个
(function donothing() { })()
第二个样本失败
TypeError: undefined is not a function
这是为什么?
与;
你的代码正常工作。
代替
(function donothing() { })()
使用
;(function donothing() { })()