After doing some research, I came up with this solution:
export const getTotal = (revenue) => {
let sum = 0;
for (let i = 0; i < revenue.length; i++) {
sum += revenue[i];
}
return sum;
}

However, I don't recall seeing this combination += in any lessons so far. Is there another way of solving this task without using these symbols?

    Write a Reply...