I am trying to sum multiple decimals numbers together however when I console the result it is showing a concatenated result with an undefined in front of it
for (let i = 0; i < this.performInternationalSwiftPaymentsService.bopSplit.length; i++) {
this.totalZARForeign += this.performInternationalSwiftPaymentsService.bopSplit[i].randValue;
}
console.log(this.totalZARForeign)
console result –> undefined4752.861188.22
The result I want is for it to add 4752.86 and 1188.22 together in this example
Any idea what I am doing wrong. I also tried adding a parseFloat here this.totalZARForeign += parseFloat(this.performInternationalSwiftPaymentsService.bopSplit[i].randValue);
but then I get NaN in the console result