<p>I have a variable of type Number, and i like to obtain the sign (if is '-' i like to have -1 and if '+' i like to have 1). So, i made this:</p>

<pre><code>var sign = Math.abs(n) / n;
</code></pre>

<p>But, there is any other way? Better than this?</p>

You'll be in trouble if n == 0... how about this:
```
```
var sign = n < 0 ? -1 : 1;
```
```