Comment #123 on issue 164 by [email protected]: Wrong order in Object properties interation
http://code.google.com/p/v8/issues/detail?id=164

I'm surprised too see such discussion on that. Order is unspecified by a standard, and no one should expect it or foce it to be specified.

If you have a case where you want to iterate over values in specific order, then use following:

Object.keys(obj).sort(compareFn).forEach(function (key) {
  var value = obj[key];
});

compareFn is function with which you determine order you want (you may omit it if you want alphabetical order).


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to