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));
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved