iteration order for Object

Allen Wirfs-Brock allen at wirfs-brock.com
Fri Mar 11 11:37:39 PST 2011


On Mar 10, 2011, at 5:44 PM, Charles Kendrick wrote:

> This behavior was perfectly consistent across all browsers until Chrome 6.  I think it's more appropriate to say that Chrome is not interoperable with thousands of sites than to define interoperable behavior based on a minority browser's very very recent break from a de-facto standard that stood for 15 years.

Note that it isn't just Chrome.  IE9 also has similar behavior (at least in its late platform previews, I don't have the RC installed yet)

On IE9 preview 1.9.8023.6000 standards mode:

var a={x:'x', 3:3, 2:2,1:1}; a.a='a';
print(Object.keys(a));   //--> 1,2,3,x,a
print(JSON.stringify(a); //-->  {"1":1,"2":2,"3":3,"x":"x","a":"a"}
var k=''; for (var e in a) k+=e+" ";
print(k);  //--> 1 2 3 x a




More information about the es-discuss mailing list