javascript array to string without commas 1

javascript array to string without commas

// array.join(separator)

var myArray ['foo', 'bar', 'baz'];
myarray.join(':');
// foo:bar:baz

Here is what the above code is Doing:
1. We create an array with three elements.
2. We call the join method on the array, passing in a colon as the separator.
3. The join method returns a string with the elements of the array separated by the separator.

Similar Posts