This is a discussion caused by a problem in the small XI fat, and after the end everyone deepened the understanding of many parsefloat.
As follows
16 binary number 0x10 use parsefloat to turn into numbers, and the result is 0. The subconscious expects the result to be 16.
Some people say that the brain is disabled, 16 of the number of binary why to use parsefloat, because 16 binary is not divided into int and float (that is the 10 binary). It is true that the actual project cannot do so, and this is the only way to discuss it.
Look at the explanation of parsefloat in the norm.
The approximate step is to first convert the arguments to a string, remove the whitespace characters, return a non-numeric character to Nan, and finally return a valid floating-point number. Note that the other characters are not parsed and ignored directly. So for ' 0x10 ', starting with 0 parsing, the x is stopped, and the last 0 is returned.
As follows
This proves the case, and the non-numeric characters stop parsing.
But with one exception,
' 2e ' as above, E ignores the return of 2, but ' 2e2 ' returns 200
What is the reason for this? Because the E2 in ' 2e2 ' is a power operation, that is, 10*10, after parsing to E, it is found that there are no numbers left behind.
More straight explanations on MDN.
That is, parsefloat only handles "+ +", "0-9", decimal point, and Symbol e, and stops parsing when other characters are encountered.
Related:
Https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat
Javascript parsefloat Internal parsing rules