Pages

Reduce à fond la forme !

Prérequis :


En action :


const words = [10,2,2,1,10,10,10,10,10];

const o = words.reduce((a, x) => {
   if (!a[x]) a[x] = 0;
   a[x]=a[x]+1;
return a},{});