method Array.sort
Private
Array.sort(compareFn?: (
a: T,
b: T,
) => number
): this

Sorts an array in place. This method mutates the array and returns a reference to the same array.

Parameters

optional
compareFn: (
a: T,
b: T,
) => number

Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.

[11,2,22,1].sort((a, b) => a - b)

Return Type

this