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

What is output of “20” + 20? In javascript?

671


Which is faster jquery or javascript?

656


What is the purpose of local variables?

626


Is javascript object a hash table?

678


How to change the background color of HTML document using JavaScript?

694


Can you have a function within a function in javascript?

658


what is function of stdio.h

2231


Is javascript a dynamic language?

658


all possible test cases for normal number field,name field date field,check box,

1174


What is meaning of === in javascript?

645


How to define name function in javascript?

709


What will be the output of the following statements?

696


What creates scope in javascript?

653


Define anonymous function.

696


Why is javascript hoisting?

664