title: Binary to Decimal Conversion in JavaScript
body: <p>I have created a function to convert ascii to decimal:</p>
  
  <pre><code>function asciiToDecimal(text) {
      var decimal = "";
  
      for (var i=0; i &lt; text.length; i++) {
          decimal += text[i].charCodeAt(0).toString(10) + " ";
      }
      return decimal;
  }
  </code></pre>
  
  <p>and now I want to convert binary to decimal directly. I have tried to convert to ascii and then decimal but that is not always possible. I have seen a couple of other SO Q&amp;A that present a function, but the answer is usually not the the desired output (see below).</p>
  
  <p><strong>Input:</strong></p>
  
  <pre><code>01101101 01111001 00100000 01101110 01100001 01101101 01100101 00100000 01101001 01110011 00100000 01101010 01101001 01101101 00111111
  </code></pre>
  
  <p><strong>Desired Output:</strong></p>
  
  <pre><code>109 121 32 110 97 109 101 32 105 115 32 106 105 109 63
  </code></pre>
  
  <p>How can this be achieved? </p>