2011/9/6 gaz Heyes <gazhe...@gmail.com>:
> On 6 September 2011 19:12, Poetro <poe...@gmail.com> wrote:
>>
>> 2011/9/6 gaz Heyes <gazhe...@gmail.com>:
>> > I found this which was quite surprising:
>> >
>> > !function x(){x=123;alert(x);}()
>> >
>> > What's the value of x without running the code?
>>
>> The value of x depends on the environment. In case of V8 the x is not
>> defined, so a console.log(x) after the function is run will result in
>> a ReferenceError. In case of Fx the result will be REALLY weird, as it
>> was a list of plugins for me. In IE it will most likely produce the
>> number 123.
>
> All the browsers I tested IE, Chrome, FF and Opera will return the value of
> the function and not 123 :)

Your question was the value of x. And i assumed the value of x after
running the code above. And that has different values in different
environments. You didn't ask what is alerted, because that is
different.

-- 
Poetro

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to