Get the number and round to whole number
<p>I'm getting the miles from Google Map API V3 and displaying it in a textbox based on the from and to addresses. I want to parse out the number and round it off to the nearest whole number.</p>

<p>Miles = "29.9 mi" // i want the result as 30
Miles = "9.3 mi" // 10</p>

<p>I tried Math.round but it's returning NAN.</p>

<pre><code>if (status == google.maps.DirectionsStatus.OK) {
        directionsDisplay.setDirections(response);
        var miles = response.routes[0].legs[0].distance.text;
        miles = Math.round(miles);
        $('#TotalMiles').val(miles);
    }
</code></pre>
