How do you convert numbers between different bases in
JavaScript?

Answers were Sorted based on User's Feedback



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

Answer / kmbkrishnan

using parseInt(value,base)

Is This Answer Correct ?    23 Yes 2 No

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

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

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

Answer / rubin thomas

also parseFloat(number,base)

Is This Answer Correct ?    12 Yes 5 No

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

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

Post New Answer

More JavaScript Interview Questions

What are the different ways in which we can use the link tag ? Illustrate with an example. Is it possible to link a file with another file on a different file server ? If yes, how ?

1 Answers  


What is array explain it?

0 Answers  


What is difference between javascript and jscript?

0 Answers  


What are the scopes of a variable in javascript?

0 Answers  


How you can modify XAML content from JavaScript in Silverlight?

0 Answers  






What is argument objects in javascript?

0 Answers  


What is the difference between null and undefined?

0 Answers  


How would you organize your javascript code?

0 Answers  


What is console.log()?

0 Answers  


Is array a data type in javascript?

0 Answers  


In javascript what is an argument object?

0 Answers  


what is the difference between wrappers and primitives es: diff between int i=200 in primitives and integeri = new integer(54)

0 Answers  


Categories