JavaScript » Array » join

Syntax:
Array.join(separator)

The join method is used to join all the elements of an array into a single string separated by a specified string separator (if none is specified, the default is a comma).

The join method is used to join all the elements of an array into a single string separated by a specified string separator (if none is specified, the default is a comma).

Examples

Code:
cars.join(" + ")
Output:
Mercedes + Ford + Chrysler
Explanation:

This example produces a string of all the elements of the array 'cars' separated by a plus sign (+)