Share via


parseFloat Method (JScript 5.6) 

Returns a floating-point number converted from a string.


parseFloat(numString) 

Remarks

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

The parseFloat method 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 method.

Requirements

Version 1

Applies To: Global Object (JScript 5.6)

See Also

Reference

isNaN Method (JScript 5.6)
parseInt Method (JScript 5.6)
String Object (JScript 5.6)