Re: variable declarations shadowing named properties on window

Ojan Vafai:
> Firefox behaves differently for frames and elements I believe (or maybe
> names versus IDs?).
>
> <div id="a"></div><script>alert(a);</script> // Alerts "[object
> HTMLDivElement]"
> <div id="a"></div><script>alert(a);var a;</script> // Alerts "undefined"
> <div id="a"></div><script>var a;alert(a);</script> // Alerts "undefined"

Note that the last two should always be the same because property 
creation due to var statements is handled first before the script is run.

Received on Wednesday, 4 January 2012 03:24:48 UTC