Subj : Retaining property order in Rhino To : netscape.public.mozilla.jseng From : Larry Blair Date : Tue Apr 29 2003 02:49 pm A major difference between Rhino and Spidermonkey is that if you define a bunch of properties for an object in SM ('var x={a:"B", c:"D");'), "for..in" will return the properties in the order defined and Rhino does not. Unfortunately, a number of the programmers who worked on our application wrote code that relies on this behavior. Since grep finds 372 instances of "for..in" in the app, it would be far simpler for me to change Rhino than to change the app. I have found 2 distinct ways in which Rhino randomizes the hash. First, the property names appear to be returned by getIDs() in a random order. Since the properties are kept in an array, I'm not sure why this is the case. The other place is that properties created using the "{a:b, c:d}" syntax are passed to put() in a random order. I would be grateful for pointers as to what to change to get the same behavior as SM. .