You should have read W3Schools:
> However, if numbers are sorted as strings, "25" is bigger than "100", because "2" is bigger than "1".
> However, if numbers are sorted as strings, "25" is bigger than "100", because "2" is bigger than "1".
You should read MDN
The default sort order is according to string Unicode code points.
If compareFunction is not supplied, elements are sorted by converting them to strings and comparing strings in Unicode code point order. For example, "Banana" comes before "cherry". In a numeric sort, 9 comes before 80, but because numbers are converted to strings, "80" comes before "9" in Unicode order.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
So this:
['Banana', 'cherry', 'bagel', 'apple'].sort()
Will produce this order:
["Banana", "apple", "bagel", "cherry"]