Skip to main content
Float16Array.sort - Platform - Web documentation
method Float16Array.sort
Private
Float16Array.sort(compareFn?: (
a: number,
b: number,
) => number
): this

Sorts an array.

Parameters

optional
compareFn: (
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

this