Standard built-ins
parseFloat()
Reads a decimal floating-point prefix, including exponent notation or Infinity, and ignores trailing invalid text. Returns NaN if no valid prefix exists.
Formal Syntax & Structure
javascript syntaxjavascript
parseFloat(value)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| value | any | Converted to text before parsing. |
Return Value
number
Parsed Number, possibly NaN.
Working Example
Example Snippetjavascript
console.log(parseFloat("12px"));