Check if number is positive or negative
Wed Sep 27 2023 12:52:20 GMT+0000 (Coordinated Universal Time)
Saved by @Paloma
The Math.sign() returns 1 or -1, indicating the sign of the number passed as argument. If the input is 0 or -0, it will be returned as-is.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign
Comments