How to use parseFloat in JavaScript

This article describe about parseFloat() Function in JavaScript.
  • 1828

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.




Parameter Description
string Required. string to be parse.


<!DOCTYPE html>



<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 />");








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


More Articles

© 2020 DotNetHeaven. All rights reserved.