const A = Pizzas.reduce((acc, {w}) => ( new Set([...acc,...w]) ),new Set);
const AA = new Set(Pizzas.reduce((acc, {w}) => ([...acc,...w]),[]));
const C = Pizzas.reduce((a, {w}) => {
for (let ing of w){
if (!a[ing]) a[ing] = 0;
a[ing]+=1;
}
return a;
},{});
for (let [ing, nb] of Object.entries(C)){
console.log(`${ing} : ${nb}`);
}
/*************************************
const sum = (accumulator, currentValue) => accumulator + currentValue,
max = (accumulator, currentValue) => Math.max(accumulator,currentValue),
sortDist = (a, b) => (a.price > b.price ? -1 : 1);
function add( pizza ){
let t = [];
for (let inc of pizza.w){
t.push(price.get(inc))
}
pizza.price = t.reduce(sum);
return pizza
}
let g = Pizzas.map( add );
console.log(g)