Skip to content

Instantly share code, notes, and snippets.

@abrarShariar
Created June 24, 2020 06:14
Show Gist options
  • Save abrarShariar/18b131f7bf21eb6d89e67abe7d232f72 to your computer and use it in GitHub Desktop.
Save abrarShariar/18b131f7bf21eb6d89e67abe7d232f72 to your computer and use it in GitHub Desktop.
solution
const totalNumberOfPurchase = purchases.reduce((allTotal, product) => {
const sum = product.records.reduce((total, record) => {
return total + record.purchase_num;
}, 0);
return allTotal + sum;
}, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment