var obj = {
'51' : { 'name':'name1'},
'66' : { 'name':'name2'},
'58' : { 'name':'name3'}
};
$(function() {
s = '';
$.each(obj, function(k, v) {
s += ' '+k;
});
alert(s);
});
In IE and Firefox it's 51 66 58, but in Opera and Chrome it's 51 58 66 Why Jquery.each() sort by key in opera, chrome? What can i do to keep native order?
p.s if array keys is a string, result 51j 66j 58j perhaps opera and chrome try to convert keys to integer where it's possible
var obj = {
"51j" : { "name":"name1"},
"66j" : { "name":"name2"},
"58j" : { "name":"name3"}
};