myArray.join( [ separator ] ) in ECMAScript 262
Returns a string representation of the array, separated by the delimiter of your choice.
Arguments
| name | type | description |
|---|---|---|
| separator | String | [optional] The string to separate each el |
- Return Type
- String
Description
Calls the
toString() method of each value in the array, and joins them together with the seperator supplied.
If separator is omitted, a single comma "," is used. If you want no separator between the values, specify an empty string "".
var words = [ 'The' , 'quick' , 'brown' , 'fox' ];
//The following statements are all true
words.join() == "The,quick,brown,fox";
words.join(' ') == "The quick brown fox";
words.join(' :: ') == "The :: quick :: brown :: fox";
words.join('') == "Thequickbrownfox";