Basic JavaScript Question:

Download Job Interview Questions and Answers PDF

How to convert numbers to strings using JavaScript?

JavaScript Interview Question
JavaScript Interview Question

Answer:

We can prepend the number with an empty string in JavaScript

var mystring = ""+myinteger;

//or

var mystring = myinteger.toString();
We can specify a base for the conversion,
var myinteger = 14;
var mystring = myinteger.toString(16);

mystring will be "e".

Download JavaScript Interview Questions And Answers PDF

Previous QuestionNext Question
How to convert a string to a number using JavaScript? How to test for bad numbers using JavaScript?