like this:

var foo = 45;
var bar = '' + foo;

Actually, even though I typically do it like this for simple convenience, over 1,000s of iterations it appears for raw speed there is an advantage for .toString()

See Performance tests here (not by me, but found when I went to write my own): http://jsben.ch/#/ghQYR

Fastest based on the JSPerf test above: str = num.toString();

It should be noted that the difference in speed is not overly significant when you consider that it can do the conversion any way 1 Million times in 0.1 seconds.

Update: The speed seems to differ greatly by browser. In Chrome num + '' seems to be fastest based on this test http://jsben.ch/#/ghQYR

Update 2: Again based on my test above it should be noted that Firefox 20.0.1 executes the .toString() about 100 times slower than the '' + num sample.

Answer from scunliffe on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › parseInt
parseInt() - JavaScript | MDN
The parseInt function converts its first argument to a string, parses that string, then returns an integer or NaN. If not NaN, the return value will be the integer that is the first argument taken as a number in the specified radix. (For example, a radix of 10 converts from a decimal number, ...
🌐
W3Schools
w3schools.com › jsref › jsref_parseint.asp
JavaScript parseInt() Method
The parseInt method parses a value as a string and returns the first integer. A radix parameter specifies the number system to use: 2 = binary, 8 = octal, 10 = decimal, 16 = hexadecimal. If radix is omitted, JavaScript assumes radix 10.
🌐
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.
🌐
Flexiple
flexiple.com › javascript › convert-int-to-string
JavaScript Number to String – How to Use toString to Convert an Int into a String - Flexiple
Learn how to convert integers to strings in JavaScript using the toString() method with examples and easy-to-follow steps. Perfect for beginners!
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Number › toString
Number.prototype.toString() - JavaScript | MDN
The toString() method of Number values returns a string representing this number value. function hexColor(c) { if (c < 256) { return Math.abs(c).toString(16); } return 0; } console.log(hexColor(233)); // Expected output: "e9" console.log(hexColor("11")); // Expected output: "b" ... An integer ...
🌐
Better Programming
betterprogramming.pub › what-is-the-best-way-to-convert-a-string-to-a-number-in-javascript-67052a1706c6
The Best Way to Convert a String to a Number in JavaScript | by ...
March 6, 2020 - Clarity should be taken into consideration when making decisions about such shortcuts. Not everyone may be aware of this behavior, which could lead to confusion for someone reading your code, whereas parseInt() is clear and concise. In my opinion, generally speaking, you should use code that describes what it does instead of code that uses a side-effect of a non-operation · Another shortcut of sorts, if you know the string that you are seeking to convert is a number, you can multiply it by one to convert it:
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Numbers_and_strings
Numbers and strings - JavaScript | MDN
This chapter introduces the two most fundamental data types in JavaScript: numbers and strings. We will introduce their underlying representations, and functions used to work with and perform calculations on them.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › convert-a-number-to-a-string-in-javascript
Convert a Number to a String in JavaScript - GeeksforGeeks
July 23, 2025 - This method belongs to the Number.Prototype object. It takes an integer or a floating-point number and converts it into a string type.
🌐
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 - Notice how the value of the str variable is enclosed in double quotation marks: var num = 24; var str = num.toString(); console.log(num); // 24 console.log(str); // "24" You can also call the toString() method immediately on a number value, ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Number › parseInt
Number.parseInt() - JavaScript | MDN
The Number.parseInt() static method parses a string argument and returns an integer of the specified radix or base. function roughScale(x, base) { const parsed = Number.parseInt(x, base); if (Number.isNaN(parsed)) { return 0; } return parsed * 100; } console.log(roughScale(" 0xF", 16)); // ...
🌐
Medium
medium.com › @rwijayabandu › how-to-convert-number-to-string-in-javascript-7c08e221e5b0
How to convert number to string in JavaScript? | by Ravithamara | Medium
August 18, 2024 - Concatenate the empty string with the number, it will convert the whole number to a string. One of the easiest ways to convert any integer or floating-point number into a string.
🌐
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 - The toString() method converts the number to its string equivalent, preserving the numeric value as text. In these examples, 42.toString() becomes '42' and 3.14159.toString() becomes '3.14159'.
🌐
HostingAdvice
hostingadvice.com › home › how-to › javascript: int to string
JavaScript: int to string
March 24, 2023 - There isn’t really much more to using toString() on numbers in JavaScript.
🌐
Favtutor
favtutor.com › articles › number-to-string-javascript
Convert Number to String in JavaScript (5 Easy Methods)
November 23, 2023 - In this example, we have used the toString() function to convert the number 9 to a string. We passed various radices and stored the obtained strings in different variables which are printed on the console.
🌐
Go Make Things
gomakethings.com › converting-numbers-to-strings-with-vanilla-javascript
Converting numbers to strings with vanilla JavaScript | Go Make Things
Today, we’re looking at how to convert numbers to strings with JavaScript. Let’s dig in! You can use the Number.toFixed() method to format a number to a fixed number of decimal places. Pass in the number of decimal places as an argument.
🌐
Vultr Docs
docs.vultr.com › javascript › standard-library › Number › toString
JavaScript Number toString() - Convert to String | Vultr Docs
September 27, 2024 - ... let value = 255; let message ... message smoothly, making the code cleaner and the output easily readable. 1.The toString() method in JavaScript is not limited to numbers—it can also convert other data types into string ...
🌐
upGrad
upgrad.com › home › tutorials › software & tech › convert string to int in javascript
Convert String to int in JavaScript
February 3, 2025 - As a bonus for sticking with me for so long in this tutorial, I will quickly take you through converting int back to string in case you need it for experimenting with Java Script string to int. Let us check out some JavaScript convert string to int examples.
🌐
DEV Community
dev.to › kiani0x01 › how-to-convert-javascript-number-to-string-5dad
How to Convert JavaScript Number to String - DEV Community
July 6, 2025 - A quick and dirty way to convert a number is by adding an empty string + ''. JavaScript will coerce the number into a string, and you get your result in one short line.