0

私がこれを行うとき:

parseInt(39,16)

私はこれを得る:

 57 

2 番目の引数の意味は何ですか?

私はこれを読みました:

radix   Optional. A number (from 2 to 36) that represents the numeral system to be used

しかし、16 という数字で何が得られるでしょうか。

4

2 に答える 2

2

The second argument is the number system you're using - in your case "39" is hexadecimal, because you passed "16" as a second argument.

Please refer to the documentation.

So if you want to get decimal number, use:

parseInt(39, 10);
于 2013-03-04T07:23:39.053 に答える
0

For example, a radix of 10 indicates to convert from a decimal number, 8 octal, 16 hexadecimal, and so on. For radices above 10, the letters of the alphabet indicate numerals greater than 9. For example, for hexadecimal numbers (base 16), A through F are used.

ParseInt documentation

于 2013-03-04T07:23:36.203 に答える