algorithms-exercises
algorithms-exercises copied to clipboard
Missing compare function in test
According to MDN docs on Array.prototype.sort
The default sort order is ascending, built upon converting the elements into strings
[100,2].sort()
// [100, 2]
So we would need the compare function to sort numbers properly
[100,2].sort((a,b) => a - b)
// [2, 100]