How do you convert numbers between different bases in
JavaScript?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to add html elements dynamically with JavaScript?

498


Why extending array is bad idea?

576


How to calculate fibonacci numbers in javascript?

504


Example of using regular expressions for syntax checking in javascript?

460


What are the valid scopes of a variable in JavaScript?

480






Why is javascript so hard?

449


What is the difference between test () and exec () methods?

614


Who created npm?

479


Explain the working of timers in JavaScript? Also elucidate the drawbacks of using the timer, if any?

564


What are the ways of making comments in javascript?

444


What is null in programming?

521


How do I open a .js file?

451


What is a function callback?

540


Where do I write javascript code?

505


Why would you use a sticky session?

508