3👍
✅
it sounds like you should use a reduce
const total = this.equities.reduce((sum, equity) => {
const myEquityCalc = << something >>;
return sum + myEquityCalc;
}, 0)
Demo:
const equities = [{value: 100}, {value: 200}];
const total = equities.reduce((sum, equity) => {
return sum + equity.value;
}, 0)
console.log(total)
Source:stackexchange.com