How do you convert numbers between different bases in
JavaScript?
Answers were Sorted based on User's Feedback
Answer / venkateswaran
using Number() function we can converts the value of an
object to a number.
Example:
var test1= new Boolean(true);
var test2= new Date();
var test3= new String("999");
document.write(Number(test1)+ "<br />");
document.write(Number(test2)+ "<br />");
document.write(Number(test3)+ "<br />");
| Is This Answer Correct ? | 11 Yes | 3 No |
Answer / heena
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)
| Is This Answer Correct ? | 6 Yes | 3 No |
Does apple use javascript?
Why is javascript hoisting?
What is Browser Object Model?
How to get complete current page url with javascript?
Is javascript a highly secure scripting language?
Is javascript free to install?
What are disadvantages of using javascript?
How to create multiline strings in javascript?
What is the relationship between Java script, J script and ECMA script?
How to call a function in every x seconds in javascript?
How to port a GUI application onto Web
Which built-in method reverses the order of the elements of an array?