title: Double exclamation points?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/784929/what-is-the-not-not-operator-in-javascript">What is the !! (not not) operator in JavaScript?</a><br>
    <a href="https://stackoverflow.com/questions/1406604/what-does-the-operator-double-exclamation-point-mean-in-javascript">What does the !! operator (double exclamation point) mean in JavaScript?</a>  </p>
  </blockquote>
  
  
  
  <p>So I was debuging some code and ran across this:</p>
  
  <pre><code>var foo.bar = 0; // this is actually passed from another function, adding it for context
  
  function(foo) {
      var someVar = !!foo.bar;
  
      if (foo.bar) {
        // ..stuff happens
      } else {
        // .. something else happens
      }
  }
  </code></pre>
  
  <p>Okay my questions is what is the point of <code>!!</code>? All that is doing is making the <code>0 === false</code>. </p>
  
  <ol>
  <li><p>Is there any benefit to using that compared to <code>boolean(foo.bar)</code>?</p></li>
  <li><p>foo.bar can be evaluated in an if as is because <code>0 === false</code> already, so why go through the conversion? (someVar is not reused anywhere else)</p></li>
  </ol>