Today in the time to see jquery used in the parsefloat (the first parameter, 10), has not understood what the second parameter means, so the Internet to check a bit, afraid of forgetting to write down.
Definitions and usages: the parsefloat () function parses a string and returns a floating-point number.
Syntax: parsefloat (String), parameter string is required to represent the string to be resolved
Return value: Returns the parsed number
Attention Matters:
1. The opening and closing spaces are allowed.
2. If the first character of the string cannot be converted to a number, then parsefloat () returns NaN
3. If you want to resolve only the integer portion of a number, use the parseint () method.
4. Only the first digit in the string is returned.
attached examples:
Copy Code code as follows:
<script type= "Text/javascript" >
document.write (parsefloat ("10"))
document.write (parsefloat ("10.00"))
document.write (parsefloat ("10.33"))
document.write (Parsefloat ("34 45 66"))
document.write (parsefloat ("60"))
document.write (parsefloat ("Years"))
document.write (Parsefloat ("He is 40"))
</script>
output sequentially:
10
10
10.33
34
60
40
NaN
Here's the second question: What do you mean by 10 in parsefloat (first argument, 10)? The second parameter of the parsefloat represents the transformation of the system, and 10 represents the transition to 10.