How do you convert numbers between different bases in JavaScript ?

 Posted by Bharathi Cherukuri on 6/18/2012 | Category: JavaScript Interview questions | Views: 3923 | Points: 40
Answer:

By using the parseInt() function, we can convert numbers between different bases in JavaScript. This function takes a string as the first parameter, and the base as a second parameter.

Example:

To convert hexadecimal 3F to decimal, we use
parseInt ("3F", 16);


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response