title: How does !!~ (not not tilde/bang bang tilde) alter the result of a 'contains/included' Array method call?
body: <p>If you read the comments at the jQuery <code>inArray</code> page <a href="http://api.jquery.com/jQuery.inArray/">here</a>, there's an interesting declaration:</p>
  
  <pre><code>!!~jQuery.inArray(elm, arr) 
  </code></pre>
  
  <p>Now, I believe a double-exclamation point will convert the result to type <code>boolean</code>, with the value of <code>true</code>.  What I don't understand is what is the use of the tilde (<code>~</code>) operator in all of this?</p>
  
  <pre><code>var arr = ["one", "two", "three"];
  if (jQuery.inArray("one", arr) &gt; -1) { alert("Found"); }
  </code></pre>
  
  <p>Refactoring the <code>if</code> statement:</p>
  
  <pre><code>if (!!~jQuery.inArray("one", arr)) { alert("Found"); }
  </code></pre>
  
  <p>Breakdown:</p>
  
  <pre><code>jQuery.inArray("one", arr)     // 0
  ~jQuery.inArray("one", arr)    // -1 (why?)
  !~jQuery.inArray("one", arr)   // false
  !!~jQuery.inArray("one", arr)  // true
  </code></pre>
  
  <p>I also noticed that if I put the tilde in front, the result is <code>-2</code>.  </p>
  
  <pre><code>~!!~jQuery.inArray("one", arr) // -2
  </code></pre>
  
  <p>I don't understand the purpose of the tilde here.  Can someone please explain it or point me towards a resource?</p>