title: calling parseInt on string in node js returns NaN
body: <p>I'm passing in a Buffer from the client-side using the binaryjs module in node js. This buffer contains a pipe delimited string that I eventually parse on the server.</p>
  
  <p>On the client side I convert a String to a Uint8Array. My String looks something like this:</p>
  
  <pre><code>var stringToConvert = 'A_1_22|B_2_33|C_3_44';
  </code></pre>
  
  <p>When this Uint8Array is passed to my server, it's received as a Buffer. I first chunk together the Buffer into an array:</p>
  
  <pre><code>var parts = [];
  // ...
  // as data is received:
  parts.push(data);
  </code></pre>
  
  <p>When I have all the data streamed, I convert this array to a String and split by "|":</p>
  
  <pre><code>var arrayString = parts.toString().split("|");
  </code></pre>
  
  <p>This gets me the desired array output:</p>
  
  <pre><code>arrayString = ['A_1_22', 'B_2_33', 'C_3_33'];
  </code></pre>
  
  <p>I then iterate over this arrayString and split again by "_".</p>
  
  <pre><code>for(var i = 0; i &lt; arrayString.length; i++)
  {
      var thisArray = arrayString[i].split("_");
      // ...
  </code></pre>
  
  <p>The problem occurs when I try to iterate over thisArray to convert the second and third values to ints:</p>
  
  <pre><code>var intVal1 = parseInt(thisArray[1]); // returns NaN
  var intVal2 = parseInt(thisArray[2]); // returns NaN
  console.log(typeof thisArray[1]); // returns string
  </code></pre>
  
  <p>Running the identical code on the client side properly converts the strings to ints. Not sure what I'm missing here?</p>