javascript convert an integer to a string code example

Example 1: javascript convert number to string

var myNumber=120;
var myString = myNumber.toString(); //converts number to string "120"

Example 2: change no to string in js

var num = 15;
var n = num.toString();

Example 3: tostring js

var num = 15;
var n = num.toString(); /* now */ "15"

Example 4: int to string javascript

var number = 12;
return numner.toString();

Example 5: string to number javascript

new Number(valeur);
var a = new Number('123'); // a === 123 donnera false
var b = Number('123'); // b === 123 donnera true
a instanceof Number; // donnera true
b instanceof Number; // donnera false

Tags:

Misc Example