Standard built-ins
Number.parseFloat()
The Number static property refers to the same built-in function as the corresponding global parser. 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
Number.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(Number.parseFloat("12px"));