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
🌐
SPGuides
spguides.com › typescript-array-to-string-with-separator
How to Convert Typescript Array to String With Separator?
July 21, 2025 - Learn how to convert a TypeScript array to a string with a custom separator. Step-by-step guide with examples to join array elements efficiently.
🌐
xjavascript
xjavascript.com › blog › typescript-array-to-string-with-separator
TypeScript Array to String with Separator: A Comprehensive Guide — xjavascript.com
In JavaScript (and thus TypeScript), the join() method is used for this purpose. The join() method creates and returns a new string by concatenating all of the elements in an array, separated by a specified separator string.
Discussions

How to convert array into comma separated string in javascript - Stack Overflow
I have an array: a.value = [a,b,c,d,e,f] How can I convert to comma-seperated string like: a.value = "a,b,c,d,e,f" More on stackoverflow.com
🌐 stackoverflow.com
How do I convert an array to a string with commas in JavaScript
...you get a better, more thorough explanation here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join More on reddit.com
🌐 r/JavaScriptTips
1
4
April 13, 2023
Turn Array Into String, Separate String With Separator - JavaScript - Stack Overflow
Define a function, myJoin, that accepts up to two arguments: array separator (string, optional) myJoin should return a string with all of the elements from the array joined together. The separator ... More on stackoverflow.com
🌐 stackoverflow.com
[javascript] how to effectively convert string to array while removing commas and the space at the beginning/end if there was any?
Trim after the split with map, so str.split(",").map((s) => s.trim()) Much easier to read than regex imo More on reddit.com
🌐 r/webdev
7
1
September 14, 2021
🌐
Webdevtutor
webdevtutor.net › blog › typescript-array-to-string-separator
Converting TypeScript Array to String with Separator
const array: string[] = ["apple", ... | banana | orange" Converting a TypeScript array to a string with a separator can be done efficiently using methods like join and reduce....
🌐
TutorialsPoint
tutorialspoint.com › typescript › typescript_array_join.htm
TypeScript - Array join()
join() method joins all the elements of an array into a string. separator − Specifies a string to separate each element of the array. If omitted, the array elements are separated with a comma.
🌐
Webdevtutor
webdevtutor.net › blog › typescript-array-of-objects-to-string-with-separator
Converting TypeScript Array of Objects to String with Separator
interface Person { name: string; ... objects and specify a separator as ', '. We then use the map() method to transform each object into a formatted string and finally join these strings using the specified separator....
🌐
ReqBin
reqbin.com › code › javascript › ot8wzla9 › javascript-array-to-string-example
How do I convert array to string in JavaScript?
To convert an array to a string using a separator between elements in JavaScript, you can use the array.join(separator) method:
Find elsewhere
🌐
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

🌐
TutorialsPoint
tutorialspoint.com › home › typescript › typescript string split
TypeScript String Split
December 18, 2016 - Learn how to split strings in TypeScript using the split() method with examples and detailed explanations.
🌐
Educative
educative.io › answers › what-is-the-join-method-of-an-array-in-typescript
What is the join() method of an array in TypeScript?
This method returns the combination of all the elements of the array as a single string. ... Lines 2–5: We declare three arrays: names, numbers, and cars and initialize them with elements. Line 8: We use the join() method to combine the elements of names using the separator, " ", and print the returned string to the console.
🌐
GeeksforGeeks
geeksforgeeks.org › typescript › typescript-array-join-method
TypeScript Array join() Method - GeeksforGeeks
July 12, 2024 - In this example, we join an array of numbers into a single string using the default comma separator.
🌐
Altcademy
altcademy.com › blog › how-to-convert-array-to-string-in-javascript
How to convert array to string in JavaScript - Altcademy.com
August 29, 2023 - In this example, the join() function takes the fruits array and converts it into a string. Note that each array element is separated by a comma.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › join
Array.prototype.join() - JavaScript | MDN - Mozilla
Because the string returned by Array.prototype.toString (which is the same as calling join()) does not have delimiters, nested arrays look like they are flattened. You can only control the separator of the first level, while deeper levels always use the default comma.
🌐
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 - The join() method combines all array elements into a single string, using the provided separator between each element. In this example, fruits.join(', ') creates a comma-separated string ‘apple, banana, orange’. You can use any separator: ...
🌐
xjavascript
xjavascript.com › blog › typescript-array-tostring
Mastering TypeScript Array `toString()`: A Comprehensive Guide
The toString() method in TypeScript arrays is inherited from the JavaScript Array.prototype.toString(). When you call the toString() method on an array, it converts each element of the array to a string and then concatenates these strings, ...
🌐
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 - When you want just the comma character (,) to appear as the separator between items in the list, use .join(",") to convert the array to a string.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › toString
Array.prototype.toString() - JavaScript - MDN - Mozilla
July 20, 2025 - When an array is cyclic (it contains an element that is itself), browsers avoid infinite recursion by ignoring the cyclic reference. ... Following the behavior of join(), toString() treats empty slots the same as undefined and produces an extra separator:
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › convert-array-to-string-in-javascript
Convert Array to String in JavaScript - GeeksforGeeks
July 23, 2025 - Using default separator: a,b,c ... string , Type of str3: string · The JSON.stringify() method converts an array including even the nested arrays and objects to a JSON string....