Sort does not do what you are expecting by default when it comes to numbers.
The default sort is always alphabetical… even when the array has numbers in it.
Try use it like this:
arr.sort((a, b) => a - b);
The callback function(a, b) { return a - b; } is the way to use Array.sort when you are intending to sort by numeric value.
Just as a side note.
This is a classic example of how our non-empirical assumptions may lead to bugs or unexpected results.
Always read the docs for a function/method/library/api you have not built yourself as most of the time behaves differently than you expect.
I have done this mistake way too many times.