~ in javascript
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/6260475/how-to-the-operator">How to: The ~ operator?</a>  </p>
</blockquote>



<p>What's the ~ operator does in javascript?</p>

<p>input</p>

<pre><code>alert(~1)
</code></pre>

<p>output is</p>

<pre><code>-2 
</code></pre>

<p>input</p>

<pre><code>~function () {}()
</code></pre>

<p>output is </p>

<pre><code>-1
</code></pre>

<p>I never heard about ~ operator in javascript</p>
