JavaScript Global method: parseFloat()
[this page | pdf | back links]
The JavaScript
Global
parseFloat() parses a string and
returns a floating point number, assuming that the string can be interpreted as
such a number. It finds the first character after leading spaces, works out if
this is one that can appear in a number and then continues parsing the string
until it reaches the end of any part that is interpretable as a number,
returning that number as a number value, not a string. If the first available
non-space character is not numerical then the method returns NaN. Only the first of multiple
numbers will be returned.
It
has the following syntax with the following parameters:
parseFloat(x)
|
Parameter
|
Required / Optional
|
Description
|
|
x
|
Required
|
String forming the input
parameter
|
NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)