Sort
The sort
method sorts the items of an array in a specific order (ascending or descending).
To fix the sorting issue in numbers, compare functions are used. Compare functions defines ort orders and return a negative, zero, or positive value based on the arguments.
The sort()
method overrides the original array.
Last updated
Was this helpful?