DEVFYI - Developer Resource - FYI

How do you convert numbers between different bases in JavaScript?

JavaScript Interview Questions and Answers


(Continued from previous question...)

11. How do you convert numbers between different bases in JavaScript?

Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt ("3F", 16);

(Continued on next question...)

Other Interview Questions