Convert JavaScript array into comma-separated list
29-12-2015 16:25:10
JAVASCRIPT / Array
0 Bookmark(s)
183 View(s)
If the strings do not contain commas you can use the join method to concat the array into a csv list.
var arr = new Array(3);
arr[0] = "First";
arr[1] = "Second";
arr[2] = "Third";
var csv = arr.join(",");
You can also callToString() on the array, this does the same.