Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Global Methods</h1>
<h2>The parseFloat() Method</h2>
<p>parseFloat() parses a string and returns the first number:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
parseFloat("40.00") + "<br>" +
parseFloat("   40   ") + "<br>" +
parseFloat("40 years") + "<br>" +
parseFloat("40H") + "<br>" +
parseFloat("H40");
</script>
</body>
</html>