数组去重
const arr=[...new Set([1,2,2,3])]
const arr=Array.from(new Set([1,2,2,3]))
const arr = [1, 1, 2, 2, 3, 4, 5];
const uniqueArray = [...new Map(arr.map(item => [item, item])).values()];
const arr = [1, 1, 2, 2, 3, 4, 5];
const uniqueArr = arr.filter((value, index, self) => {
return self.indexOf(value) === index;
});
const arr = [1, 1, 2, 2, 3, 4, 5];
const uniqueArray = arr.reduce((acc, cur) => {
if (!acc.includes(cur)) {
acc.push(cur);
}
return acc;
}, []);