title: Calculating binary of array using array.reduce
body: <p>I have tried to calculate binary of a number provided in an array using naive for-loop method.
  Than I find a solution which works but I am not able to understand how it is working.
  I need help to understand this.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const binaryArrayToNumber = arr =&gt; {
    return arr.reduce((a,b)=&gt;(a&lt;&lt;1|b),0);
  };
      
  
  console.log(binaryArrayToNumber([1,1,1,1]))</code></pre>
  </div>
  </div>
  </p>