title: Purpose of logical operators on strings in Javascript
body: <p>I have stumbled across a bit of code that I was hoping someone could explain to me.</p>
  
  <p>This is used in the context of jqGrid.</p>
  
  <pre><code>onSelectRow: function(id){ 
       if(id &amp;&amp; id!==lastsel){ 
            jQuery('#rowed3').jqGrid('restoreRow',lastsel);
            jQuery('#rowed3').jqGrid('editRow',id,true); 
            lastsel=id; 
       } 
  }, 
  </code></pre>
  
  <p>Why use logical operators on a string in javascript as shown above? Is this simply a bug or is there some functionality here that I dont understand?</p>
  
  <p>Code is taken from <a href="http://trirand.com/blog/jqgrid/rowedex3.html" rel="nofollow">http://trirand.com/blog/jqgrid/rowedex3.html</a></p>
  
  <p>Full example <a href="http://trirand.com/blog/jqgrid/jqgrid.html" rel="nofollow">http://trirand.com/blog/jqgrid/jqgrid.html</a> > Row editing > Using events</p>