Although I could not find a link to this easily on google, I am familiar with the fact that in javascript global function declarations are interpreted before any code is executed. In other words, this works great:
f();
function f() {}
However, I noticed that chrome and firefox have different interpretations of what a global function declaration is. In particular, chrome is happy to read a function declaration that is inside an if block in the first pass, but firefox is not.
try {document.write(f);}
catch(e) {document.write(e.message);}
try {document.write(g);}
catch(e) {document.write(e.message);}
if(true) function f() {}
function g() {}
You can try this example yourself with fiddle . I am using Chrome 16.0.912.75 and Firefox 9.0.1.
ECMA ? "" ? "" ( )? ?