javascript convert list to comma separated string code example
Example 1: javascript array to comma separated string
var colors = ["red", "blue", "green"];
var colorsCSV = colors.join(",");
Example 2: .join in javascript
const elements = ['Sun', 'Earth', 'Moon'];
console.log(elements.join());
console.log(elements.join(''));
console.log(elements.join('-'));
Example 3: js array join
['h', 'e', 'y'].join('')
Example 4: javascript array to string with comma
let numbers = [0, 1, 2, 3];
let numbersToString = numbers.toString();
console.log(numbersToString);