How to use parseFloat in JavaScript
This article describe about parseFloat() Function in JavaScript.
parseFloat() Function in JavaScript
This function parse a string and returns a floating point number.
parseFloat() function define if the first character in the specified string is a number. And parses the string until reaches the end of the number.
Syntax
Parameter |
Description |
string |
Required. string to be parse. |
Example
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
document.write(parseFloat("15") + "<br />");
document.write(parseFloat("15.00") + "<br />");
document.write(parseFloat("15.55") + "<br />");
document.write(parseFloat("44 54 64") + "<br />");
document.write(parseFloat(" 50 ") + "<br />");
document.write(parseFloat("60 days") + "<br />");
document.write(parseFloat("I am 60 year old") + "<br />");
</script>
</body>
</html>
|
Output

You may also want to read these related articles Click here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here