All of these will work:

`${num}`
num.toString()
'' + num
String(num)
Answer from Zihan Chen on Stack Overflow
🌐
W3Schools
w3schools.com › jsref › jsref_string.asp
JavaScript String() Method
It is supported in all browsers: Convert different values to strings: String(Boolean(0)); String(Boolean(1)); String([1,2,3,4]); Try it Yourself » · ❮ Previous JavaScript Global Methods Next ❯ · ★ +1 · Sign in to track progress ·
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › toString
String.prototype.toString() - JavaScript | MDN
January 25, 2026 - The String object overrides the toString method of Object; it does not inherit Object.prototype.toString(). For String values, the toString method returns the string itself (if it's a primitive) or the string that the String object wraps.
🌐
Medium
medium.com › dailyjs › 5-ways-to-convert-a-value-to-string-in-javascript-6b334b2fc778
5 Ways to Convert a Value to String in JavaScript | by Samantha Ming | DailyJS | Medium
May 27, 2019 - JavaScript news and opinion. ... It’s also the one I use because it’s the most explicit — making it easy for other people to follow the intention of your code 🤓 · Remember the best code is not necessarily the most clever way, it’s the one that best communicates the understanding of your code to others 💯 · const value = 12345;// Concat Empty String value + '';// Template Strings `${value}`;// JSON.stringify JSON.stringify(value);// toString() value.toString();// String() String(value);// RESULT // '12345'
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › convert-a-number-to-a-string-in-javascript
Convert a Number to a String in JavaScript - GeeksforGeeks
July 23, 2025 - These are the following ways to Convert a number to a string in JavaScript: This method belongs to the Number.Prototype object. It takes an integer or a floating-point number and converts it into a string type. JavaScript · let a = 20; console.log(a.toString()); console.log((50).toString()); console.log((7).toString(2)); // (7 in base 2, or binary) Output ·
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-convert-an-object-to-string-using-javascript
How to convert an object to string using JavaScript ? - GeeksforGeeks
July 11, 2025 - It first creates a boolean value ... strings using the String() constructor. Similarly, it converts a number to a string. Finally, it logs the types before and after conversion for each case. JSON.stringify() converts the JavaScript object to a string which is needed ...
🌐
DEV Community
dev.to › code_2 › 10-ways-to-convert-a-value-to-string-in-javascript-23de
10 Ways to Convert a Value to String in JavaScript - DEV Community
December 30, 2024 - Using a unary + converts strings to numbers, but combined with .toString(), it can convert them back to strings.
Find elsewhere
🌐
2ality
2ality.com › 2012 › 03 › converting-to-string.html
Converting a value to string in JavaScript
Both approaches use the internal ToString() operation to convert primitives to string. “Internal” means: a function specified by the ECMAScript 5.1 (§9.8) that isn’t accessible to the language itself.
🌐
Bbody
jsstringconverter.bbody.io
Multiline JavaScript Converter
Converts multiline text into a JavaScript multiline string. This includes both concatenated string in ECMA5 and the new template literal in ECMA6
🌐
HTML Goodies
htmlgoodies.com › home › javascript
Converting a JavaScript Object to a String | HTML Goodies
August 14, 2022 - Meanwhile, relying on implicit conversion when writing an object to any other location will only result in the utterly useless “[object Object]” string. Far better results can be achieved using JavaScript’s built-in JSON.stringify() method or ...
🌐
CoreUI
coreui.io › answers › how-to-convert-a-number-to-a-string-in-javascript
How to convert a number to a string in JavaScript · CoreUI
September 27, 2025 - Use toString() method or String() constructor to convert numbers to string format efficiently in JavaScript.
🌐
W3Schools
w3schools.com › jsref › jsref_tostring_number.asp
JavaScript Number toString() Method
The toString() method is used by JavaScript when an object needs to be displayed as a text (like in HTML), or when an object needs to be used as a string.
🌐
SitePoint
sitepoint.com › blog › javascript › quick tip: how to convert a number to a string in javascript
Quick Tip: How to Convert a Number to a String in JavaScript — SitePoint
November 7, 2024 - Then, string concatenation is used for the rest of the expression since the first operand is "it is". The third approach is using the toString() method. This method is available for all JavaScript data types, including numbers.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String
String - JavaScript | MDN
Many built-in operations that expect strings first coerce their arguments to strings (which is largely why String objects behave similarly to string primitives). The operation can be summarized as follows: Strings are returned as-is. ... Numbers are converted with the same algorithm as toString(10).
🌐
W3Schools
w3schools.com › js › js_type_conversion.asp
JavaScript Type Conversions
The global method String() can convert numbers to strings.
🌐
Vultr Docs
docs.vultr.com › javascript › standard-library › Number › toString
JavaScript Number toString() - Convert to String | Vultr Docs
September 27, 2024 - The toString() method in JavaScript offers a straightforward approach to converting a number to its string representation. This built-in function is highly versatile and essential in scenarios where you need to perform operations that require ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-convert-data-types-in-javascript
How To Convert Data Types in JavaScript | DigitalOcean
August 24, 2021 - Because of this, JavaScript will attempt to convert unexpected values rather than reject them outright. This implicit conversion is known as type coercion. Some methods will automatically convert values in order to make use of them. The alert() method takes a string as its parameter, but it will automatically convert other types into strings.
🌐
freeCodeCamp
freecodecamp.org › news › javascript-number-to-string-how-to-use-tostring-to-convert-an-int-into-a-string
JavaScript Number to String – How to Use toString to Convert an Int into a String
March 22, 2021 - The toString() method is a built-in method of the JavaScript Number object that allows you to convert any number type value into its string type representation. How to Use the toString Method in JavaScript To use the toString() method, you simply ...