The JavaScript number parseFloat() method is used to convert a string into a floating point number. It will throw NaN exception if specified can not be converted into a float number.
Syntax:
Number.parseFloat(string)
Parameters
string: It represents the string that has to be converted into a floating point number.
Returns
Floating point number.
Example:
<!DOCTYPE html> <html> <body> <script> var n= 12.334; document.writeln(Number.parseFloat("50.5FIVE")); </script> </body> </html>