Number.sign
sign() -> number
Description
Returns 1 if positive, -1 if negative.
The sign of zero is 0.
$num = 5 $num.sign() //= 1 (positive) $num = -7 $num.sign() //= -1 (negative) $num = 0 $num.sign() //= 0
Returns 1 if positive, -1 if negative.
The sign of zero is 0.
$num = 5 $num.sign() //= 1 (positive) $num = -7 $num.sign() //= -1 (negative) $num = 0 $num.sign() //= 0