Darren New wrote:
>>> Bzzzt. You just don't know javascript very well. What object do you
>>> get when foo or bar references "this"?
>>
>> I have no idea. (And no obvious way of finding out...)
>
> Hint: It's called "window".
>
> function foo() {...}
>
> is the same as
>
> window["foo"] = Function(){...}
More precisely, a 'foo' property is added to the global object, which
happens to be "window" when the JS interpreter is hosted in a web browser.
Post a reply to this message
|