title: Why does Javascript's OR return a value other than true/false?
body: <p>I saw this construction in order to get the browser viewport width:</p>
  
  <pre><code>function () { return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; }
  </code></pre>
  
  <p>I understand the browser quirks involved. What I don't understand is why <code>||</code> returns the value. So I tried this <code>alert(undefined || 0 || 3);</code> and sure enough, it alerts <code>3</code>. I find this bizarre, because I expect <code>true</code> or <code>false</code>. Could anyone explain what's going on?</p>