It seems that I have an interesting problem only in chrome (not in IE, FF). Given the following object:
var myObj = {
"59" : "Hello",
"52" : "and",
"50" : "how",
"31" : "are",
"65" : "you"
};
Going through this object through a for loop spits out the contents in the following order:
for(var j in myObj) { document.write(myObj[j] +', '); }
are, how, and, hello, you
All other major browsers give it in the correct order. Chrome treats keys as integers instead of strings. The problem is that I have a json data source that I cannot change, and I need to access the elements in the order in which they are in the object.
Can anyone suggest a way to do this in Google Chrome?
source
share