Array.prototype.join

Adds all the elements of an array into a string, separated by the specified separator string.

Syntax

join(separator);

Parameters

Return value

A string.

Example

[1, 2, 3].join()
"1,2,3"
[1, 2, 3].join(', ')
"1, 2, 3"
["tea", "coffee", "juice"].join(' or ')
"tea or coffee or juice"