title: Javascript: Add two binary numbers (returning binary)
body: <p>I have two inputs in binary, and I'm returning the addition result in binary as well. </p>
  
  <pre><code>var addBinary = function(a, b) {
      var dec = Number(parseInt(a, 2)) + Number(parseInt(b, 2));
      return dec.toString(2);
  };
  </code></pre>
  
  <p>For some insanely big binary like </p>
  
  <blockquote>
    <p>a = 10100000100100110110010000010101111011011001101110111111111101000000101111001110001111100001101 </p>
    
    <p>b = 110101001011101110001111100110001010100001101011101010000011011011001011101111001100000011011110011</p>
  </blockquote>
  
  <p>I'm outputting </p>
  
  <blockquote>
    <p>110111101100010011000101110110100000011101000101011000000000000000000000000000000000000000000000000</p>
  </blockquote>
  
  <p>where the supposed correct output is</p>
  
  <blockquote>
    <p>110111101100010011000101110110100000011101000101011001000011011000001100011110011010010011000000000</p>
  </blockquote>
  
  <p>Is it because of overflow? If so, what are the restrictions in Javascript for binary addition overflow? Sorry for the bunch of 1's and 0's.</p>