The enumeration of JS objects seems to be inconsistent in Firefox.
Code:
var a = {"3":"a", "2":"b", "foo":"c", "1":"d"};
var str = "";
for(var n in a) { str += n + " = " + a[n] + "\n"; }
alert(str);
Result with FF22 on Windows:
1 = d
2 = b
3 = a
foo = c
Result expected (and what I get with FF20 on Linux):
3 = a
2 = b
foo = c
1 = d
How can I keep the Elements in the same order as inserted?
I know the ECMA specification doesn't say how the enumeration should be done, therefore it can't be called a bug. But I need the elements in the order inserted. (Reason: I get a JSON-encoded hash-table which is ordered server-side. Until recently the order was kept, now the whole list is a mess because it's ordered by the keys)