What is operator ~ for?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/7261652/javascript-bitwise-operator-question">javascript bitwise operator question</a>  </p>
</blockquote>



<p>Documentation says, that it is <code>bitwise NOT</code>. But I don't understand these examples:</p>

<pre><code>var a = ~1; a
-2
var a = ~8; a
-9
var a = ~-1; a
0
</code></pre>
