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.
🌐
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.
🌐
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:
🌐
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....
🌐
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.
🌐
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....
🌐
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

Find elsewhere
🌐
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.
🌐
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.
🌐
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
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.
🌐
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: ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › join
Array.prototype.join() - JavaScript | MDN
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.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › toString
Array.prototype.toString() - JavaScript | MDN
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:
🌐
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.
🌐
Webdevtutor
webdevtutor.net › blog › typescript-array-of-strings-to-comma-separated-string
Converting TypeScript Array of Strings to Comma-Separated String
The most straightforward way to convert an array of strings to a comma-separated string in TypeScript is by using the Array.join() method.
🌐
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, ...