By including a function to sort by I'm no longer doing an alphabetical sort, which means this problem no longer exists.
console.log([2,3,4,11].sort((a,b)=>a-b));
Output:
(4) [2, 3, 4, 11]
The sort() method sorts the elements of an array in place and returns the array. The default sort order is built upon converting the elements into strings, then comparing their sequences of UTF-16 code units values.
By including a function to sort by I'm no longer doing an alphabetical sort, which means this problem no longer exists.
developer.mozilla.org/en-US/docs/W...
yes, by including compareFunction callback, we can solve this problem.