Does the \"for…in\" loop in Javascript loop through the hashtables/elements in the order they are declared? Is there a browser which doesn\'t do it in order?
The object
As stated by other answers, no, the order is not guaranteed.
If you want to iterate in order, you can do something like:
let keys = Object.keys(myObject);
for (let key of keys.sort()) {
let value = myObject[key];
// Do what you want with key and value
}
Note that performance-wise, this is not optimal, but that's the price when you want a nice alphabetical display.