[JavaScript] How to convert an array into a set?
In Javascript, how to convert a given array of elements into a Set?
1 Answer
4 years ago by Jahaan
You can create set from an array by passing the array to the Set constructor
let colors = ["red", "green", "blue", "orange", "maroon", "blue"];
let colorSet = new Set(colors);
console.log(colorSet);
4 years ago by Meera