0

When I do this:

parseInt(39,16)

I get this:

 57 

What does the second argument means?

I read this:

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

But what do I get with the number 16?

1
  • You can just prepend a + => +'39' = 39 Commented Mar 4, 2013 at 7:28

2 Answers 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);
Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.