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? โ€“ Learn SharePoint, Microsoft Power Platform and SPFx Tutorials โ€“ SPGuides
July 21, 2025 - The join method in TypeScript is used to join all the items of an array into a string. ... separator: The string you want to insert between each array element.
๐ŸŒ
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

How to take an array and format it as a string. Apr 28, 2022
r/learnjavascript
4y ago
array.join vs. array.toString Jul 25, 2017
r/learnjavascript
9y ago
The JavaScript Comma Operator Apr 4, 2011
r/javascript
15y ago
Escape comma when using comma as the delimiter in join() Jul 31, 2022
r/learnjavascript
4y ago
More results from reddit.com
๐ŸŒ
YouTube
youtube.com โ€บ tsinfo technologies
Convert Array to String using separator in TypeScript | TypeScript Programming | TypeScript Tutorial - YouTube
I will show you how to convert an array to a string using Typescript methods in this TypeScript video tutorial. By using the below methods:1. Using Join()2. ...
Published: October 6, 2023
Views: 42
๐ŸŒ
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.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ typescript-array-join-method
TypeScript Array join() Method - GeeksforGeeks
July 12, 2024 - The Array.join() method in TypeScript is a built-in function used to join all the elements of an array into a single string. This method is particularly useful when you need to concatenate array elements with a specific separator.
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ what-is-the-join-method-of-an-array-in-typescript
What is the join() method of an array in TypeScript?
The join() method in TypeScript is used to join the elements of an array as a string. ... separator: This is a character or string that separates each element of the array when joined as a string.
๐ŸŒ
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.
Find elsewhere
๐ŸŒ
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....
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ typescript โ€บ typescript_string_split.htm
TypeScript - String split()
If separator is omitted, the array returned contains one element consisting of the entire string. limit โˆ’ Integer specifying a limit on the number of splits to be found. The split method returns the new array. Also, when the string is empty, split returns an array containing one empty string, rather than an empty array.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ typescript-array-tostring-method
TypeScript Array toString() Method - GeeksforGeeks
July 12, 2024 - In TypeScript, the string is sequence of char values and also considered as an object. It is a type of primitive data type that is used to store text data. The string values are used between single quotation marks or double quotation marks, and also array of characters works same as a string.
๐ŸŒ
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.
๐ŸŒ
Webdevtutor
webdevtutor.net โ€บ blog โ€บ typescript-array-to-string-with-comma
Converting TypeScript Array to String with Comma
The most straightforward way to convert an array to a string with comma separation in TypeScript is by using the join() method.
๐ŸŒ
Webdevtutor
webdevtutor.net โ€บ blog โ€บ typescript-array-as-string
Converting TypeScript Array to String: A Comprehensive Guide
One of the simplest ways to convert a TypeScript array to a string is by using the join() method. This method concatenates all the elements of an array into a string, with an optional separator between each element.
๐ŸŒ
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. ... AI-Native Senior Full-Stack SWE ยท UI/UX Engineer ยท TypeScript specialist ยท 20+ years of ...
๐ŸŒ
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....
๐ŸŒ
Webdevtutor
webdevtutor.net โ€บ blog โ€บ typescript-array-into-string
Converting TypeScript Array into String: A Comprehensive Guide
One of the simplest and most effective ways to convert an array into a string in TypeScript is by using the join() method. This method concatenates all the elements of an array into a single string, with an optional separator between each element.