Standard built-ins

Number.parseFloat()

Try the free JavaScript compiler

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

NameTypeDescription
valueanyConverted to text before parsing.

Return Value

number

Parsed Number, possibly NaN.

Working Example

Example Snippetjavascript
console.log(Number.parseFloat("12px"));
JavaScript Reference