Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Discrepancy between Google Chrome and Firefox

I'm getting different results for this fiddle on Google Chrome (14.0.835.186) and Firefox (6.0.2).

Can anyone explain the discrepancy? What is the behaviour determined by the specifications?

EDIT: On Firefox I see [0], [0, 1], etc. On Chrome I see [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], etc.

I'm using Mac OS 10.6.8.

like image 631
Randomblue Avatar asked Feb 22 '23 20:02

Randomblue


1 Answers

Firefox is more technically correct in this case as it outputs the state of the object at each point in the loop whereas Chrome is apparently waiting until the end of the loop to output each console.log, but I'm not aware of a standards specification that covers the console host object.

See this jsFiddle: http://jsfiddle.net/jfriend00/LRGP2/ to show that this is only console.log that has this odd behavior.

like image 170
jfriend00 Avatar answered Mar 05 '23 17:03

jfriend00