Definition and usage of parseFloat() method:
The parseFloat() method can parse a string and return a floating point number.
Note: If the first character in the string cannot be converted into a number, this method returns NaN. If the string contains multiple numbers, only the first number will be returned.
Click to view more global methods and properties of ECMAScript.
Grammar structure:
Parameter list:
Example code:
Output result: 123.
Only the first number can be returned. Output result: 123.
The first character cannot be converted to a number. Output result: NaN.
Output result: 12.