sign(x) → {integer}
A value representing the sign of the value: -1 for negative, +1 for positive, 0 if value is 0.
This works differently from Math.sign
for values of NaN and -0, etc.
Parameters
Name | Type | Description |
---|---|---|
x | number |
Returns
integer -
An integer in {-1, 0, 1}
- Source code: math/Math.js (Line 1138)
Please login to continue.