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