Why do we get sorted object keys when creating an object using a loop over an unsorted array of numbers. is there an explanation for this behavior?
const arr = [2,1,4,3,9,6];
let obj = {};
for(const el of arr2){
obj[el] = []
}
Expectation
obj = { '2': [], '1': [], '4': [], '3': [], '9': [], '6': [] }
What I got
obj = { '1': [], '2': [], '3': [], '4': [], '6': [], '9': [] }