Regarding the ordering of the properties of an object in Javascript, I will simply contact this answer:
The order of elements in the "for (... in ...)" loop
In particular:
All modern implementations of ECMAScript iterate through a property object in the order in which they were defined
Thus, every other answer is correct here, there is no official guaranteed order for object properties. However, in practice there is (a ban on any errors that, of course, can spoil even officially established behavior).
In addition, the de facto order of listing object properties is likely to be codified in future EMCAScript specifications.
However, at this time I will not write code around this, mainly because there are no built-in tools to help deal with the order of object properties. You can write your own, but at the end you will always iterate over each property in the object to determine its position.
So the answer to your question is No , there is no way other than scrolling through an object.
MooGoo Nov 30 '10 at 19:34 2010-11-30 19:34
source share