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 |
What is the Infinity property used for in Javascript?
How to remove duplicate values from a javascript array?
Why javascript is so popular?
What's math constants and functions using javascript?
Does spacing matter in javascript?
What are the pop-up boxes available in javascript?
What are javascript objects?
How to reload a page using JavaScript?
Write a Program of Simple Calculator in JavaScript using HTML.
How to detect the operating system on the client machine?
List some of the disadvantages of javascript.
How to define a named function in JavScript?