I used parseFloat (first parameter, 10) When I was reading jquery today. I was very confused about the two parameters. So I collected the information and shared it with you, I hope this article will help you. If you are interested, you can understand that parseFloat (the first parameter, 10) is used in jquery today ), I have never understood what the second parameter means, so I checked it online and wrote it down if I forget it later.
Definition and usage: The parseFloat () function parses a string and returns a floating point number.
Syntax: parseFloat (string). The string parameter is required, indicating the string to be parsed.
Return Value: return the parsed number.
Notes:
1. spaces at the beginning and end are allowed.
2. If the first character of a string cannot be converted to a number, parseFloat () returns NaN
3. If you only want to parse the integer part of a number, use the parseInt () method.
4. Only the first digit in the string will be returned.
Attached example:
The Code is as follows: