title: When to use the double not (!!) operator in JavaScript
body: <p>I understand <a href="https://stackoverflow.com/questions/1406604/what-does-the-operator-double-exclamation-point-mean-in-javascript">what the double not operator does in JavaScript</a>. I'm curious about it's use though and whether or not a recent assertion that I made is correct.</p>
  
  <p>I said that <code>if (!!someVar)</code> is never meaningful nor is <code>(!!someVar &amp;&amp; ...</code> because both the <code>if</code> and the <code>&amp;&amp;</code> will cause someVar to be evaluated as a boolean so the !! is superfluous.</p>
  
  <p>In fact, the only time that I could think of that it would be legitimate to use the double not operator is if you wanted to do a strict comparison to another boolean value (so maybe in return value that expects true or false explicitly).</p>
  
  <p>Is this correct? I started to doubt myself when I noticed jQuery 1.3.2 used both <code>if (!!someVar)</code> and <code>return !!someVar &amp;&amp; ...</code> </p>
  
  <p>Does the double not have any actual effect in these situations? </p>
  
  <p>My personal opinion is that it just leads to confusion. If I see an if statement, I know it's evaluating it as a boolean.</p>