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.
๐ŸŒ
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

๐ŸŒ
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.
๐ŸŒ
xjavascript
xjavascript.com โ€บ blog โ€บ typescript-array-to-string-with-separator
TypeScript Array to String with Separator: A Comprehensive Guide โ€” xjavascript.com
Converting a TypeScript array to a string with a separator is a simple yet powerful operation. The join() method provides a straightforward way to achieve this.
๐ŸŒ
Python Guides
pythonguides.com โ€บ convert-an-array-to-a-string-in-typescript
How To Convert An Array To A String In TypeScript?
February 7, 2025 - The toString() method offers a quick and simple way to convert an array to a comma-separated string, while the join() method allows for more customization by specifying a separator. ... I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine ...
๐ŸŒ
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.
Find elsewhere
๐ŸŒ
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.
๐ŸŒ
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.
๐ŸŒ
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....
๐ŸŒ
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 (,). ... If you want to use W3Schools services as an educational institution, team or ...
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ typescript โ€บ typescript_array_tostring.htm
TypeScript - Array toString()
Python TechnologiesDatabasesComputer ... ... TypeScript - null vs. undefined ... toString() method returns a string representing the source code of the specified array and its elements....
๐ŸŒ
Webdevtutor
webdevtutor.net โ€บ blog โ€บ typescript-string-array-tostring
How to Convert a TypeScript String Array to a Single String: A Comprehensive Guide
In this example, we're using the space character (' ') as the separator. You can pass any string or character that suits your needs. The reduce() method is a more powerful and flexible approach to convert an array of strings into a single string.
๐ŸŒ
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-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 โ€บ @setyawan_asep โ€บ how-to-convert-array-of-objects-into-comma-separated-string-extracting-only-one-property-ff26cfcad00e
How to Convert Array of Objects into Comma Separated String extracting only one property | by asep setyawan | Medium
March 8, 2018 - Iโ€™d like to share a quick solution which always is really useful when you are handling complex object-type data structures in JavaScript / ES6 / TypeScript. That code will be useful when you want to extract some property values from an array of objects.
๐ŸŒ
SPGuides
spguides.com โ€บ typescript-split-string
Typescript Split String [With Examples]
July 12, 2025 - To split a string by a specific character in TypeScript, you again use the split() method, specifying the character as the separator. Hereโ€™s an example where we split a string by a character -: Here is the complete code to split a string by ...