JavaScript vérifie si le tableau a des doublons
function hasDuplicates(array) {
return (new Set(array)).size !== array.length;
}
Attractive Addax
function hasDuplicates(array) {
return (new Set(array)).size !== array.length;
}
[1, 2, 3].every((e, i, a) => a.indexOf(e) === i) // true
[1, 2, 1].every((e, i, a) => a.indexOf(e) === i) // false
arr.reduce((b,c)=>((b[b.findIndex(d=>d.el===c)]||b[b.push({el:c,count:0})-1]).count++,b),[]);