1function hasDuplicates(array) {
2 return (new Set(array)).size !== array.length;
3}
1[1, 2, 3].every((e, i, a) => a.indexOf(e) === i) // true
2
3[1, 2, 1].every((e, i, a) => a.indexOf(e) === i) // false
4
1arr.reduce((b,c)=>((b[b.findIndex(d=>d.el===c)]||b[b.push({el:c,count:0})-1]).count++,b),[]);