I have an array with few objects. every obect has one key with a number.
I need to sum all those numbers
for example:
Users = [
{name: example, age: 10},
{name: example2, age: 30},
{name: example3, age: 15}
]
thats what I tried:
var sum = 0;
for (let i = 0; i < this.shippingMethod.length; i++) {
var currentValue = this.shippingDetails.shippingQuantity
sum += currentValue;
console.log(sum)
return sum
}