i have a piece of code like below
var abc =
{
2: {label: "raju"},
10: {label: "samu"},
3: {label: "sidh"},
1: {label: "kat"},
};
for(var i in abc){ alert(i); }
in mozilla fire fox it alerts 2,10,3,1. but in chrome it shows 1,2,3,10
but my requirement is the first one (as shown in fire fox) what to do for getting the same result in chrome?
for(var i in abc)is not what you think it is (an array element iterator). If you use a normal indexed for loop, and a normal array, surprises you will not get.