JavaScript Array.prototype.join() Method
The join() method combines all elements of an array into a single string, with a separator of your choice between them.
Description
The join() method creates a string by joining all the elements, converted to strings, with the separator between them. The default separator is a comma; use '' for no separator. null and undefined become empty strings.
It's the opposite of String.prototype.split(). To build a human-readable list such as "A, B and C" in any language, use Intl.ListFormat.
Nested arrays are joined using their own toString(), so [1, [2, 3]].join(';') gives "1;2,3". Objects become "[object Object]", so map them to strings first. join() is also an efficient way to build a long string from many parts, such as rows of a CSV file joined with '\n'.
Syntax
array.join()
array.join(separator)Parameters
- separatorOptional. A string to put between elements. Defaults to a comma.
Return Value
A string of all the elements joined together. An empty array gives an empty string.
Example
Browser Support
The following information will show you the current browser support for the Array.prototype.join() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





