While working on another problem, I was misled by the fact that Chrome (and perhaps other browsers) somehow magically sorts keys of an object when outputting it to the console:
let inputs = ["XMl", "SFJ", "dTg", "amN"];
let promises = {};
for (let val of inputs) {
let p = new Promise(
(resolve) => setTimeout(resolve, 500 + Math.random() * 1500, "new:" + val)
);
promises[val] = p
}
console.log(promises)
Promise.allSettled(Object.values(promises)).then((res) => console.log(res))
Now the browser (Chrome) shows me:
So, there is a difference between the expanded and the collapsed output. Is that standard behavior? Where does this come from?


