The toString()
method can be used to convert a number to a string in JavaScript.
number.toString(radix)
Parameters:
radix
: Optional; specifies the base to use to represent a numeric value; must be an integer between 2 and 36.The following returns the string representation of the number :
let number = 42;let str = number.toString();console.log(str, typeof(str));
Free Resources