1const myArray = [1,2,3,1,5,8,1,2,9,4];
2const unique = [...new Set(myArray)]; // [1, 2, 3, 5, 8, 9, 4]
3
4const myString = ["a","b","c","a","d","b"];
5const uniqueString = [...new Set(myString)]; //["a", "b", "c", "d"]
1// Use to remove duplicate elements from the array
2
3const numbers = [2,3,4,4,2,3,3,4,4,5,5,6,6,7,5,32,3,4,5]
4
5//spreading numbers of the object into an array using the new operator
6console.log([...new Set(numbers)])
7
8// [2, 3, 4, 5, 6, 7, 32]