xxxxxxxxxx
<html lang="en">
<head>
<meta charset="utf-8">
<title>JavaScript Parse Floating Point Numbers from Strings</title>
</head>
<body>
<script>
document.write(parseFloat("3.14") + "<br>"); // 3.14
document.write(parseFloat("50px") + "<br>"); // 50
document.write(parseFloat("1.6em") + "<br>"); // 1.6
document.write(parseFloat("124.5 lbs") + "<br>"); // 124.5
document.write(parseFloat("weight 124.5 lbs") + "<br>"); // NaN
document.write(parseFloat("6.5 acres")); // 6.5
</script>
</body>
</html>