1、let arr = [1,2,3,3,4,4,5];
Array.from(new Set(arr))
2、let arr = [{id:1},{id:2},{id:1},{id:3}];
var hash = {};
let arr = arr.reduce(function(item, next) {
hash[next.i] ? '' : hash[next.id] = true && item.push(next);
return item
}, [])
1、let arr = [1,2,3,3,4,4,5];
Array.from(new Set(arr))
2、let arr = [{id:1},{id:2},{id:1},{id:3}];
var hash = {};
let arr = arr.reduce(function(item, next) {
hash[next.i] ? '' : hash[next.id] = true && item.push(next);
return item
}, [])