SyntaxFix
Write A Post
Hire A Developer
Questions
I know it's been some time, but there is a more elegant solution. From the mozilla docs:
Math.sign(parseInt(-3))
It will give you -1 for negative, 0 for zero and 1 for positive.