JavaScript Konversi Nomor ke String
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 myNumber=120;
var myString = myNumber.toString(); //converts number to string "120"
const num = 123; //> type number 123
const str = num.toString(); //> type string "123"
var number = 12;
return numner.toString();
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"
function numberToString(num) {
return ''+num;
}