To join an array by a comma and a space with JavaScript, we use the join
method.
For instance, we write
const myArray = [
"css",
"html",
"xhtml",
"html5",
"css3",
"javascript",
"jquery",
"lesscss",
"arrays",
"wordpress",
"facebook",
"fbml",
"table",
".htaccess",
"php",
"c",
".net",
"c#",
"java",
];
const myString = myArray.join(", ");
to call myArray.join
with ', '
to combine the strings in myArray
into a string with the entries separated by ', '
.