first value to compare
second value to compare
The difference between the two numbers (b - a). If the result is positive, b
is larger. If the result is negative, a
is larger. If the result is 0, both numbers are equal.
const arr = [3, 1, 4, 1, 5]
arr.sort(compareNumberDescending) // [5, 4, 3, 1, 1]
Generated using TypeDoc
Number comparator function (descending)