Forum : How to convert numbers to strings using JavaScript?
Brief description  about Online courses   join in Online courses
View prabeen  patra 's Profile

How to convert numbers to strings using JavaScript?

How to convert numbers to strings using JavaScript?
Asked by prabeen patra | Mar 22, 2010 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
Hi Prabeen,
You can prepend the number with an empty string
var mystring = ""+myinteger;
or
var mystring = myinteger.toString();
You can specify a base for the conversion,
var myinteger = 14;
var mystring = myinteger.toString(16);
Mar 22, 2010