Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

parseFloat Function (JavaScript)

Converts a string to a floating-point number.

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, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Applies To: Global Object (JavaScript)

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft