dashengzi66 / note

学习笔记
0 stars 0 forks source link

数组 #14

Open dashengzi66 opened 3 years ago

dashengzi66 commented 3 years ago

数组去重

const array = [5,4,7,8,9,2,7,5];

方法1 array.filter((item,idx,arr) => arr.indexOf(item) === idx);

方法2 const nonUnique = [...new Set(array)];