join list javascript code example
Example 1: javascript array to comma separated string
var colors = ["red", "blue", "green"];
var colorsCSV = colors.join(",");
Example 2: join javascript array
const cities = ['London', 'Paris', 'Tokyo'];
const joinedCities = cities.join('-');
console.log(joinedCities);
Example 3: javascript join list of string
var myArray ['foo', 'bar', 'baz'];
myarray.join(':');
Example 4: join in array
var a = ['Wind', 'Water', 'Fire'];
a.join();
a.join(', ');
a.join(' + ');
a.join('');