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