parseFloat()

A function that reads a decimal number from the beginning of a string.

What does parseFloat() do in JavaScript?

parseFloat() — A function that reads a decimal number from the beginning of a string.

const price = Number.parseFloat("4.50 dollars");

Level: Apprentice · More JavaScript terms at this level

Updated