On 2/4/11, mcot wrote:
> I am currently seeing some weird behavior with the global object:
>
> console.log(window.foo); // this returns undefined
> console.log(this.foo);// this returns undefined
As expected, getting a property off an object, the prototype chain is
searched. When that ha
On Fri, Feb 4, 2011 at 6:44 PM, mcot wrote:
> I am currently seeing some weird behavior with the global object:
>
> console.log(window.foo); // this returns undefined
> console.log(this.foo);// this returns undefined
> console.log(foo); // this is a reference error
>
> The
On Fri, Feb 4, 2011 at 4:07 PM, Michael Geary wrote:
> The first two cases are identical to each other, because window === this
> when your code runs in the global scope. And as you noted, it is not an
> error to attempt to dereference a nonexistent property of an object - you
> simply get the un
There's nothing weird going on there, it's all defined and expected
behavior.
The first two cases are identical to each other, because window === this
when your code runs in the global scope. And as you noted, it is not an
error to attempt to dereference a nonexistent property of an object - you
s