The Math sign() static method returns 1 or -1 if a number is positive or negative or 0 if it's 0.
console.log(Math.sign(3));
// 1
console.log(Math.sign(-3));
// -1
console.log(Math.sign(0));
// 0
The Math sign() static method returns 1 or -1 if a number is positive or negative or 0 if it's 0.
console.log(Math.sign(3));
// 1
console.log(Math.sign(-3));
// -1
console.log(Math.sign(0));
// 0