Question: ❓❓❓


I have a one-dimensional array of strings in Javascript that I’d like to turn into a comma-separated list. Is there a simple way in garden-variety Javascript (or jQuery) to turn that into a comma-separated list? (I know how to iterate through the array and build the string myself by concatenation if that’s the only way.)


Good Answer: 👌👌👌

The Array.prototype.join() method:

var arr = ["Zero", "One", "Two"];

document.write(arr.join(", "));

Read More: 👉 https://stackoverflow.com/questions/201724/easy-way-to-turn-javascript-array-into-comma-separated-list