This sort is stable, as it calls Array.prototype.sort under the hood which
is guaranteed to be stable from ECMAScript 2019 onwards.
If you are using a comparator that computes a key for each item that is
expensive, consider using sortOn which will compute all the keys up
front before sorting.
Note that this differs from Array.prototype.sort in that it will sort
numbers correctly by default.
Sorts an array in place.
This sort is stable, as it calls
Array.prototype.sortunder the hood which is guaranteed to be stable from ECMAScript 2019 onwards.If you are using a comparator that computes a key for each item that is expensive, consider using sortOn which will compute all the keys up front before sorting.
Note that this differs from
Array.prototype.sortin that it will sort numbers correctly by default.