Answers for "array to set js"

15

array to set javascript

const myArray = [1,2,3,1,5,8,1,2,9,4];
const unique = [...new Set(myArray)]; // [1, 2, 3, 5, 8, 9, 4]

const myString = ["a","b","c","a","d","b"];
const uniqueString = [...new Set(myString)]; //["a", "b", "c", "d"]
Posted by: Guest on July-25-2020
0

array from set javascript

let array = Array.from(mySet);
Posted by: Guest on October-18-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language