Answers for "typescript sum values in array of objects"

2

typescript sum all array values

const sum = receiptItems.reduce((sum, current) => sum + current.total, 0);
Posted by: Guest on November-16-2020
1

javascript sum of number in object array

run.addEventListener("click", function () {
    let sum = people.reduce(function (a, b) { // function(previousValue, currentValue)
      return {
        age: a.age + b.age, //select age in object array
      };
    });
    console.log(sum); //output sum of ages
  });
Posted by: Guest on October-09-2020

Code answers related to "typescript sum values in array of objects"

Code answers related to "Javascript"

Browse Popular Code Answers by Language