next up previous contents
Next: parseInt Up: Methods Previous: Methods   Contents


parseFloat

Description

Converts strings into floating-point numbers.


Syntax

parseFloat(string)


Parameters

string
The string to read and convert to a floating-point number.


Returns

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


Example

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




Copyright ©2000-2007 Shanghai TopCMM Software Technologies. All Rights Reserved.