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 ‘Strict’ mode in JavaScript and how can it be enabled?
Are you concerned that older browsers don't support javascript and thus exclude a set of web users? Individual users?
What are the different ways to create an array in javascript?
What is string in javascript?
What are the data types supported by javascript?
What is the use of a number object in javascript?
why java is called platform independent?
What is npm javascript?
What is the use of a weakset object in javascript?
How to create a function in javascript?
Are java and javascript the same?
what is event bubbling and event capturing in javascript?