JavaScript -Array zu String mit Kommas
var colors = ["red", "blue", "green"];
var colorsCSV = colors.join(","); //"red,blue,green"
digimax
var colors = ["red", "blue", "green"];
var colorsCSV = colors.join(","); //"red,blue,green"
[1, 2, 3].join(""); // 123
const selectedPlaces=[
{ name: 'Stockholm', isChecked: true },
{ name: 'Dubai', isChecked: true },
{ name: 'San Francisco', isChecked: 'false' },
]
const tempSelectedPlace = selectedPlaces.filter(place => place.isChecked === true);
//[{ name: 'Stockholm', isChecked: true },{ name: 'Dubai', isChecked: true },]
const selectedPlace = tempSelectedPlace.map(place => place.name).join(', ')
console.log(selectedPlace)
//Stockholm,Dubai
let numbers = [0, 1, 2, 3];
let numbersToString = numbers.toString();
console.log(numbersToString);
// output is "0,1,2,3"
[1, 2, 3].join(""); // 123
var str = array.join(' '); //'apple tree'
// separator ---------^