I have some strange behavior in JavaScript that I can not understand. For example, we have an object assigned to a variable with string keys in unordered fashion like this
TestObj = {"16":"Bartram Santora","20":"Steffane MacCaffrey","26":"Rozella Dusey","21":"Diego Smartman","28":"Hans Handling","29":"Nonie Gronous"};
It can be seen that index "21" comes after the "26" but when the code executed in Firefox or Chrome console we get an ordered results back like this.
{"16": "Bartram Santora","20": "Steffane MacCaffrey","21": "Diego Smartman","26": "Rozella Dusey","28": "Hans Handling","29": "Nonie Gronous"}
And this is not just shown in consoles, I iterated over the object and outputted in HTML and it is actually ORDERED.
So I cannot get it, why browsers order the UNORDERED objects and treat them like an array. I need the exact unordered list that I get from the server. I do understand that there are indexes that can be casted as numbers not just usual string keys but this is an object not an array.
Does this behavior have some logic behind it or this is just a bug?