How to convert JavaScript Array to comma separated string?
In this small post, let’s take a look at how to convert an array of elements to a CSV string in JavaScript.
You can use Array.prototype.join() method to join the array elements with a special character and convert it to CSV.
var cities = ["New York", "Manchester", "Sydney"]; let csv = cities.join(","); console.log(csv); //New York,Manchester,Sydney