Skip to content

Instantly share code, notes, and snippets.

@stephen-lazaro
Created October 4, 2018 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephen-lazaro/7fc1e96b1d1c7cf3b3b6e8c85a810fda to your computer and use it in GitHub Desktop.
Save stephen-lazaro/7fc1e96b1d1c7cf3b3b6e8c85a810fda to your computer and use it in GitHub Desktop.
// Single aggregate, summing the balances of records
const getSumOfBalance = report => {
// Declare our goal
let sumOfBalance = 0;
// Sum each balance into our goal
report.forEach(function (record) {
sumOfBalance += record.balance;
});
// Return the achieved goal
return sumOfBalance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment