Answers for "convert array of javascript into string with comma"

1

javascript array to string with commas

var colors = ["red", "blue", "green"];
var colorsCSV = colors.join(","); //"red,blue,green"
Posted by: Guest on February-05-2022
1

convert array of javascript into string with comma

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
Posted by: Guest on May-07-2022
1

javascript array to string with comma

let numbers = [0, 1, 2, 3];
let numbersToString = numbers.toString();

console.log(numbersToString);
// output is "0,1,2,3"
Posted by: Guest on March-02-2021

Code answers related to "convert array of javascript into string with comma"

Code answers related to "Javascript"

Browse Popular Code Answers by Language