I have worked out two ways of calculating the same thing in my JavaScript. I just wonder which is more efficient in terms of memory usage and processing power:
AveragePL = netArray.reduce((sum,arr) => sum + arr, 0);
or
for (let index in netArray) {
AveragePL = AveragePL + netArray[index];
}
I realise I could do AveragePL += netArray[index] but I am new to JS, so I am using the full form so that I know what is going on for a moment.