Joins all elements of an array into a string.
Method of Array
Syntax
array.join(separator)
Parameters
Parameter | Description |
---|---|
separator | Specifies a string to separate each element of the array. The separator is converted to a string if necessary. If omitted, the array elements are separated with a comma. |
Description
The string conversions of all array elements are joined into one string.
Examples
The following example creates an array, a, with three elements, then joins the array three times: using the default separator, then a comma and a space, and then a plus.