How to use the !! expression?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/784929/what-is-the-not-not-operator-in-javascript">What is the !! (not not) operator in JavaScript?</a><br>
  <a href="http://stackoverflow.com/questions/9549780/reference-what-does-this-symbol-mean-in-javascript">Reference - What does this symbol mean in JavaScript?</a>  </p>
</blockquote>



<p>I find the js code write like this ： !!undefined , !!false;</p>

<p>the jquery source code (jQuery 1.7.0.js: Line 748):</p>

<pre><code>grep: function( elems, callback, inv ) {       
    var ret = [], retVal;        
    inv = !!inv;         
    // Go through the array, only saving the items       
    // that pass the validator function        
    for ( var i = 0, length = elems.length; i &lt; length; i++ ){              
        retVal = !!callback( elems[ i ], i );            
        if ( inv !== retVal ) {                
            ret.push( elems[ i ] );            
        }        
    }         
    return ret;    
}
</code></pre>
