20101129

Countdown Started: T-4

When this counter hits 0 something's really changing

Stay Tuned.

20101124

Firefox and Chrome: Different JavaScript behaviour

Dear JavaScript Devs,

I'm debugging right now a script of mine, which behaves totally different on Firefox and Chrome.
I wonder which software is more correct.

Given this (you can just do it in the javascript console of both browsers):

a=[1,2,3]
for (var i in a)  {console.log(a[i]); }

The output is this:

Firefox:

>>> a=[1,2,3]
[1, 2, 3]
>>> for (var i in a) { console.log(a[i]);}
1
2
3

Chromium:


a=[1,2,3]
[1, 2, 3]
for (var i in a) { console.log(a[i]); }
1
2
3
undefined

Now I'm stucked. Firefox gives (IMHO) the right behaviour, while Chromium doesn't.
I wonder if this is a bug in Chromium, or is this just the right defined JavaScript Language behaviour and Firefox is wrong?

If you can give me an answer, that would be great, and furthermore I would like to know how you do overcome this bug.

UPDATE: I just checked this small script with Internet Explorer 8, and it looks like that it behaves the same as Chromium. Now I'm more confused.