title: How does x|0 floor the number in JavaScript?
body: <p>In the accepted answer on my earlier question
  ( <a href="https://stackoverflow.com/questions/8775962/what-is-the-fastest-way-to-generate-a-random-integer-in-javascript">What is the fastest way to generate a random integer in javascript?</a> ), I was wondering how a number loses its decimals via the symbol <code>|</code>
  .</p>
  
  <p>For example:</p>
  
  <pre><code>var x = 5.12042;
  x = x|0;
  </code></pre>
  
  <p>How does that floor the number to <code>5</code>?</p>
  
  <p>Some more examples:</p>
  
  <pre><code>console.log( 104.249834 | 0 ); //104
  console.log( 9.999999 | 0 );   // 9
  </code></pre>