js filter 数组去重
1 let arr = [1, 2, 3, 10, 4, 5, 1, 3, 5]; 2 let stateNumArr = arr.filter((item, index, array) => { 3 return array.indexOf(item) === index; 4 }); 5 console.log(stateNumArr);
学习在于积累:滴水可以石穿! 学而不思则罔,思而不学则殆!
1 let arr = [1, 2, 3, 10, 4, 5, 1, 3, 5]; 2 let stateNumArr = arr.filter((item, index, array) => { 3 return array.indexOf(item) === index; 4 }); 5 console.log(stateNumArr);