即使在不同的浏览器中,此代码也始终有效:
function fooCheck() {
alert(internalFoo()); // We are using internalFoo() here...
return internalFoo(); // And here, even though it has not been defined...
function internalFoo() { return true; } //...until here!
}
fooCheck();
Run Code Online (Sandbox Code Playgroud)
但是,我无法找到它应该起作用的单一参考.我第一次在John Resig的演示文稿中看到过这个,但它只是提到了.那里或其他任何地方都没有解释.
有人可以赐教吗?