The method array.toString() actually calls array.join() which result in a string concatenated by commas. ref

var array = ['a','b','c','d','e','f'];
document.write(array.toString()); // "a,b,c,d,e,f"

Also, you can implicitly call Array.toString() by making javascript coerce the Array to an string, like:

//will implicitly call array.toString()
str = ""+array;
str = `${array}`;

Array.prototype.join()

The join() method joins all elements of an array into a string.

Arguments:

It accepts a separator as argument, but the default is already a comma ,

str = arr.join([separator = ','])

Examples:

var array = ['A', 'B', 'C'];
var myVar1 = array.join();      // 'A,B,C'
var myVar2 = array.join(', ');  // 'A, B, C'
var myVar3 = array.join(' + '); // 'A + B + C'
var myVar4 = array.join('');    // 'ABC'

Note:

If any element of the array is undefined or null , it is treated as an empty string.

Browser support:

It is available pretty much everywhere today, since IE 5.5 (1999~2000).

References

  • ECMA Specification
  • Mozilla
  • MSDN
Answer from Victor on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › join
Array.prototype.join() - JavaScript | MDN
The join() method of Array instances creates and returns a new string by concatenating all of the elements in this array, separated by commas or a specified separator string. If the array has only one item, then that item will be returned without using the separator.
🌐
W3Schools
w3schools.com › jsref › jsref_join.asp
JavaScript Array join() Method
The join() method returns an array as a string. The join() method does not change the original array. Any separator can be specified. The default is comma (,). array.join(separator) Array Tutorial · Array Const · Basic Array Methods · Array ...
🌐
Reddit
reddit.com › r/javascripttips › how do i convert an array to a string with commas in javascript
r/JavaScriptTips on Reddit: How do I convert an array to a string with commas in JavaScript
April 13, 2023 -

In JavaScript, you can convert an array to a string with commas using the join()
method.

The join() method returns a string that concatenates all the elements of an array, separated by the specified separator, which in this case is a comma.

Here is an example:

const array = ['apple', 'banana', 'orange'];
const string = array.join(', ');
console.log(string); 

// output: "apple, banana, orange"

In this example, we first define an array of three fruits. Then we use the join()
method with a comma and a space as the separator to create a string that lists all the fruits with a comma and a space between each one.

You can replace the comma and space separator with any other separator you like, such as a hyphen, a semicolon, or a newline character.

It's important to note that the join() method only works on arrays, and it will throw an error if you try to use it on any other type of object.

Click here to learn more ways to Convert Array to String with Commas in JS

🌐
CoreUI
coreui.io › answers › how-to-convert-an-array-to-a-string-in-javascript
How to convert an array to a string in JavaScript · CoreUI
September 23, 2025 - Use the join() method to convert an array into a string with custom separators in JavaScript efficiently.
🌐
daily.dev
daily.dev › home › blog › get into tech › join method javascript: faqs answered
Join Method JavaScript: FAQs Answered
December 22, 2025 - The join() method in JavaScript is an essential tool for converting arrays into strings. This method allows you to specify a separator for the items in the array, defaulting to a comma if none is provided.
🌐
CodingNomads
codingnomads.com › javascript-array-to-string-conversion
JavaScript Array-String Conversion
The .join() Array method is used to convert an array to a string. It takes an optional separator argument, which is used to separate the array elements in the string. If no separator is specified, the array elements are separated with a comma.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › split
String.prototype.split() - JavaScript | MDN
All values that are not undefined or objects with a [Symbol.split]() method are coerced to strings. ... A non-negative integer specifying a limit on the number of substrings to be included in the array. If provided, splits the string at each occurrence of the specified separator, but stops ...
Find elsewhere
🌐
ReqBin
reqbin.com › code › javascript › ot8wzla9 › javascript-array-to-string-example
How do I convert array to string in JavaScript?
If you need to convert an array to a string with a specific separator, use the Array.join(separator) method. In this JavaScript Array to String example, we use the Array.toString() method to convert an array with elements to a string.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › toString
Array.prototype.toString() - JavaScript | MDN
The toString method of arrays calls join() internally, which joins the array and returns one string containing each array element separated by commas. If the join method is unavailable or is not a function, Object.prototype.toString is used instead, returning [object Array]. js · const arr ...
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-convert-array-to-comma-separated-string
Convert Array to String (with and without Commas) in JS | bobbyhadz
The Array.join() method will return a string where all of the array elements are joined with a comma separator.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › convert-array-to-string-in-javascript
Convert Array to String in JavaScript - GeeksforGeeks
July 23, 2025 - The String() method converts the array elements to string and then concatenates them with commas as a separator.
🌐
Medium
medium.com › coding-at-dawn › how-to-convert-an-array-to-a-string-with-commas-in-javascript-79e212506c2
How to Convert an Array to a String with Commas in JavaScript | by Dr. Derek Austin 🥳 | Coding at Dawn | Medium
January 5, 2023 - One of JavaScript’s most helpful built-in array methods is .join() (Array.prototype.join()), which returns a string primitive. “The join() method creates and returns a new string by concatenating all of the elements in an array (or an array-like object), separated by commas or a specified separator string.” — MDN Docs
🌐
Altcademy
altcademy.com › blog › how-to-convert-array-to-string-in-javascript
How to convert array to string in JavaScript
August 29, 2023 - As you can see, the join() function can handle nested arrays quite well, converting all elements to a string and separating them with commas. Transforming arrays into strings in JavaScript can be thought of as transforming a line of separate words into a complete sentence.
🌐
DEV Community
dev.to › gaelgthomas › array-to-string-without-commas-in-javascript-4mg6
Array to String Without Commas in JavaScript - DEV Community
September 18, 2022 - with parameter: your array will ... If you want to join your array with something different than commas, you can pass the separator of your choice....
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-array-join-method
JavaScript Array join() Method - GeeksforGeeks
March 15, 2018 - The JavaScript join() method is used to combine all elements of an array into a single string. The elements are separated by a specified separator, with a comma (,) as the default.
🌐
GeeksforGeeks
geeksforgeeks.org › create-a-comma-separated-list-from-an-array-in-javascript
Create a Comma Separated List from an Array in JavaScript | GeeksforGeeks
December 28, 2024 - The code uses map(String) to convert each element of the array arr into a string, and then join(',') joins these string elements with commas. The result is a comma-separated string "1,2,3,4,5", which is logged to the console.