JavaScript - Arrays - join

javascript-arrays

// JavaScript - Array.prototype.join()
arr.join()
arr.join(separator)

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. If separator is an empty string, all 
  elements are joined without any characters in between them. Defaults to ",".

The join method returns a string with all the elements joined together by the
separator.

var a = ['Wind', 'Rain', 'Fire'];
a.join();    // 'Wind,Rain,Fire'
a.join('-'); // 'Wind-Rain-Fire'
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License