1 const array = ['a', 1, 'b', 2, '1', 'c', 'a']; 2 const unique = array.filter((value, index, arr) => arr.indexOf(value) === index); 3 4 console.log(unique); 5 6 const unique2 = [...new Set(array)]; 7 8 console.log(unique2);
1 const array = ['a', 1, 'b', 2, '1', 'c', 'a']; 2 const unique = array.filter((value, index, arr) => arr.indexOf(value) === index); 3 4 console.log(unique); 5 6 const unique2 = [...new Set(array)]; 7 8 console.log(unique2);