📜  唯一数组 javascript es6 Map - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:25.561000             🧑  作者: Mango

代码示例3
const categories = ['General', 'Exotic', 'Extreme', 'Extreme', 'General' ,'Water', 'Extreme']
.filter((value, index, categoryArray) => categoryArray.indexOf(value) === index);

This will return an array that has the unique category names
['General', 'Exotic', 'Extreme', 'Water']