Keys in object will be auto-sorting into an increasing numeric order:
let obj = {};
obj[1] = 1;
obj[10] = 10;
obj[2] = 2;
console.log(JSON.stringify(obj)); // {"1":1,"2":2,"10":10}
Even if the keys are strings, sorting will be performed in order of numbers, just like above:
let obj = {};
obj['1'] = 1;
obj['10'] = 10;
obj['2'] = 2;
console.log(JSON.stringify(obj)); // {"1":1,"2":2,"10":10}