title: Javascript: Convert numbers inside the string
body: <p>Im working on a simple conversation form, where I need to input dimensions ex. 12x24x36 inches to 304.8 x 609.6 x 914.4 mm.</p>
  
  <p>My problem is I don't know how to compute convert those numbers separately.</p>
  
  <p>I manage to remove the <em>x</em> but all the numbers merge.</p>
  
  <p>Thanks, I hope you understand me.</p>
  
  <p>here is my sample code</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;h4&gt;Dimensions&lt;/h4&gt;
  &lt;label&gt;inches &lt;input id="number1"&gt;&lt;/label&gt;
  &lt;label&gt;mm &lt;input id="number2"&gt;&lt;/label&gt;
  &lt;button type="button" onclick="myFunction()"&gt;convert&lt;/button&gt;
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <pre><code>function myFunction() {
  var inches = document.getElementById("number1").value;
  
    var removex = inches.replace(/x/g,"");
  
    var input = parseInt(removex);
  
  document.getElementById("number2").value = input
  }
  </code></pre>
  
  <p><strong>CODEPEN</strong></p>
  
  <p><a href="https://codepen.io/anon/pen/yPpmej" rel="nofollow noreferrer">https://codepen.io/anon/pen/yPpmej</a></p>