Real World Func Decl in Block Scope Breakages

David Bruant bruant.d at gmail.com
Thu Dec 27 00:52:42 PST 2012


Le 27/12/2012 03:07, Brandon Benvie a écrit :
> if I run this code in the tools > web developer > web console, I get a 
> result of undefined and no error
> `if (false) { function x(){ console.log('worked') } } x();`
I see an error on Firefox Aurora 19 WebConsole on Linux. I also see it 
when I put the code between <script>.

I don't know if it's related with your case, but last I checked, the 
Firefox WebConsole had its own global (different from the content 
global). Something to keep in mind when playing with subtle ECMAScript 
things (like here, declaring a global function).

David


More information about the es-discuss mailing list