js two value from array after reduce
cartTotal(): void {
const {total, quantity} = this.carrello.plu.reduce((acc, item) => {
acc.quantity += item.qta;
acc.total = acc.total + (item.prezzo * item.qta);
return acc;
}, {total:0, quantity:0});
this.cartCount.next(acc.quantity); // emit whatever you want to emit.
}
console.log('Total Price', total, 'Total Quantity', quantity);