JavaScript Convertir el número en cadena
var myNumber=120;
var myString = myNumber.toString(); //converts number to string "120"
Grepper
var myNumber=120;
var myString = myNumber.toString(); //converts number to string "120"
var num = 15;
var n = num.toString(); /* now */ "15"
var num = 15;
var n = num.toString();
var myNumber=120;
var myString = myNumber.toString(); //converts number to string "120"
function numberToString(num) {
return num + '';
}
const num = 2
const a = num.toString() // This throws an Error if num is null or undifined
const b = String(num) // In a case above, puts "null" or "undifined"