title: Javascript String to int conversion
body: <p>I have the following JS immbedded in a page:</p>
  
  <pre><code>var round = Math.round;
  var id = $(this).attr("id");
  
  var len = id.length;
  var indexPos = len -1; // index of the number so that we can split this up and used it as a title
  
  var pasType = id.substring(0, indexPos); // adult, child or infant
  var ind = round(id.substring(indexPos)); // converts the string index to an integer
  var number = (id.substring(indexPos) + 1); // creates the number that will go in the title
  window.alert(number);
  </code></pre>
  
  <p><code>id</code> will be something like adult0, and I need to take that string and split it into adult and 0 - this part works fine.</p>
  
  <p>The problem comes in when I try to increment the 0. As you can see I use Math.round to convert it to an integer, and then add 1 to it - I expect 0 to be 1 after this. However, it doesn't seem to be converting it to integer, because I get <code>01</code>, not <code>1</code>. When testing this with adult1 the alert I get is <code>11</code>.</p>
  
  <p>I'm using <a href="https://stackoverflow.com/q/1133770/1073118">this</a> question for reference, and have also tried <code>var number += id.substring(indexPos);</code>, which breaks the JS (<code>unexpected identifier '+='</code>)</p>
  
  <p>Does anyone know what I'm doing wrong? Is there a better way of doing this?</p>