Favorites

JavaScript Array.prototype.join() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Array.prototype.join()
JavaScript Array Instance methodThis method is supported by all modern browsers.
Updated 28th November 2026

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

const words = ['Hello', 'world'];
console.log(words.join(' '));
console.log(words.join());
console.log(['2026', '11', '28'].join('-'));
console.log('a-b-c'.split('-').join('/'));

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.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee