Math.sign
sign — Check if the number is positive, negative or zero.
Description
Math.sign(number number)
Parameters
Name | Description | Type | Default | Optional |
---|---|---|---|---|
number | number | No |
Return values
mixed. Integer (1, 0, -0, 1) for numbers or NaN for non number input.
Changelog
Version | Description |
---|---|
ES 6 | Introduced. |
Examples
Example #1 – sign example