Version: v0.8.1 - Beta.  We welcome contributors & feedback.

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

See Also