Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

parseFloat Function (JavaScript)

Returns a floating-point number converted from a string.

parseFloat(numString) 

The required numString argument is a string that contains a floating-point number.

The parseFloat function returns a numerical value equal to the number contained in numString. If no prefix of numString can be successfully parsed into a floating-point number, NaN (not a number) is returned.

parseFloat("abc")      // Returns NaN.
parseFloat("1.2abc")   // Returns 1.2.

You can test for NaN using the isNaN function.

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards. See Version Information.

Applies To: Global Object (JavaScript)

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.