ES6 - Number.parseFloat()


Advertisements

This method parses a string argument and returns a float representation of the passed string.

Syntax

Number.parseFloat(string)

Parameters

  • string − value to parse

Return value

A float representation of the string.

Example

console.log(Number.parseFloat("10"));
console.log(Number.parseFloat("10.23"));

Output

10
10.23
Advertisements