The JavaScript array join() method combines all the elements of an array into a string and return a new string. We can use any type of separators to separate given array elements.
Javascript array join() method joins all the elements of an array into a string.
array.join(separator)
separator − Specifies a string to separate each element of the array. If omitted, the array elements are separated with a comma.
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var energy = fruits.join(" and ");