title: How to get driving distance without km in google map api v3
body: <p>I am getting driving distance from google map api v3 using this code.</p>
  
  <pre><code>distance11 = response.routes[0].legs[0].distance.text;
  </code></pre>
  
  <p>The code is working fine, but the output is coming in the format 300km. I need only the number 300. Please help me find a solution. </p>
  
  <p>I already tried putting distance.value and simply distance but it didn't work. </p>
  
  <p>Edit:.....</p>
  
  <p>Also please tell me how to remove string from a variable using javascript. For instance getting only 300 from 300km.</p>
  
  <p>Thanks!</p>