779Sums and NaNs in Javascript
var array = [132, 32, 14, 525, 52, 12, 52];
var sum;
for (var i=0; i
I was slightly puzzled, why the above code outputs Nan instead of the consecutive sums of the array.
var array = [132, 32, 14, 525, 52, 12, 52];
var sum = 0; // sum needs to be init...?
for (var i=0; i
After declaring sum with a number, it works. Still have to find out why.