@tempots/std
compareNumbers() function
It returns the comparison value (an integer number) between two float
values.
Signature:
compareNumbers: (a: number, b: number) => number
Parameters
Parameter |
Type |
Description |
---|---|---|
a |
number |
The first value to compare. |
b |
number |
The second value to compare. |
Returns: number
A number indicating the relative order of the two values.
Example
compare(5, 10) // returns -1
compare(10, 5) // returns 1
compare(5, 5) // returns 0