1const myArray = ['a', 1, 'a', 2, '1'];
2const unique = [...new Set(myArray)]; // ['a', 1, 2, '1']
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"]
1const categories = ['General', 'Exotic', 'Extreme', 'Extreme', 'General' ,'Water', 'Extreme']
2.filter((value, index, categoryArray) => categoryArray.indexOf(value) === index);
3
4This will return an array that has the unique category names
5['General', 'Exotic', 'Extreme', 'Water']
6
7
1var myArray = ['a', 1, 'a', 2, '1'];
2
3let unique = [...new Set(myArray)];
4
5console.log(unique); // unique is ['a', 1, 2, '1']