const positive = 5;
const negative = -5;
const zero = 0;
Math.sign(positive); // 1
Math.sign(negative); // -1
Math.sign(zero); // 0
Math.sign(num); //sign of num: if num is negative,–1; if positive, 1; and if it is 0, 0
Math.sign() has 5 possible return values:
1 // positive number
-1 // negative number
0 // positive zero
-0 // negative zero
NaN // not a number
(number < 0)
"-0" < 0 is false, which is consistent with the fact that -0 < 0 is also false (see: signed zero).
"-Infinity" < 0 is true (infinity is acknowledged)
"-1e0" < 0 is true (scientific notation literals are accepted)
"-0x1" < 0 is true (hexadecimal literals are accepted)
" -1 " < 0 is true (some forms of whitespaces are allowed)