.sort()
should reorder the items like that by default.
The default sort order is ascending, built upon converting the elements into strings, then comparing their sequences of UTF-16 code units values.
console.log(
[1, 2, 3, 4, 10, 11, 12, 20, 29, 30, 39, 40, 49, 101, 110, 119, 123].sort()
);
1
solved sorting by first digit