Skip to main content

sort

method Float16Array.sort
Jump to headingFloat16Array.sort(compareFn?: (
a: number,
b: number,
) => number
): this

Sorts an array.

Parameters Jump to heading

optional
Jump to headingcompareFn: (
a: number,
b: number,
) => number

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

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

Return Type Jump to heading

this
Back to top