I am curious, I noticed, when starting up for inon an object with number keys. It seems that the elements are sorted sequentially. Can anyone explain why this is?
const thing = {
"2": "any",
"8": "thing",
"3": "here",
"7": "x",
"6": "xx",
"1": "xxx"
};
for (var item in thing) {
console.log(item);
}
Run codeHide result
source
share