Joins elements of an array into a single string with specified delimiters.
The array of strings to join.
The string to use as a delimiter between most elements.
The string to use as a delimiter before the last element, defaults to the same as glue.
glue
Returns the joined string.
join(['apple', 'banana', 'cherry'], ', ', ' and ')// => 'apple, banana and cherry'join(['apple', 'banana'], ', ')// => 'apple, banana'join(['apple'], ', ')// => 'apple' Copy
join(['apple', 'banana', 'cherry'], ', ', ' and ')// => 'apple, banana and cherry'join(['apple', 'banana'], ', ')// => 'apple, banana'join(['apple'], ', ')// => 'apple'
Joins elements of an array into a single string with specified delimiters.