title: Javascript bitwise logic in a for loop
body: <p>I have been trying to improve my Javascript and have been going through Coderbyte's challenges. The only easy challenge left which I cant seem to crack perfectly is called "Array Addition 1"*. I am trying to compare my code with another user who has got a perfect response with the following:</p>
  
  <pre><code>function ArrayAdditionI(arr) { 
  
    for (var i = 0; i &lt; arr.length; i++) {
      arr[i] = parseInt(arr[i], 10);
    }
  
    var max = arr[0];
    for (var i = 1; i &lt; arr.length; i++) {
      max = Math.max(max, arr[i]);
    }
    //everything above makes sense
    for (var i = 0, l = 1 &lt;&lt; arr.length; i &lt; l; i++) {
      var s = 0, cnt = 0;
      for (var j = 0; j &lt; arr.length; j++) {
        if (i &amp; (1 &lt;&lt; j)) {
          s += arr[j];
          cnt++;
        }
      }
  
      if (cnt &gt; 1 &amp;&amp; s == max) {
        return true;
      }
    }
  
    return false;       
  }
  
  ArrayAdditionI(/* some array*/)        
  </code></pre>
  
  <p>Could someone please help with a plain English explanation of how the bitwise operators are being used above?</p>
  
  <p>[*]</p>
  
  <blockquote>
    <p>Have the function ArrayAdditionI(arr) take the array of numbers stored
    in arr and return the string true if any combination of numbers in the
    array can be added up to equal the largest number in the array,
    otherwise return the string false. For example: if arr contains [4, 6,
    23, 10, 1, 3] the output should return true because 4 + 6 + 10 + 3 =
    23. The array will not be empty, will not contain all the same elements, and may contain negative numbers.</p>
  </blockquote>