I'm trying to accumulate a series of numbers in an array e6
Here is the relevant code.
e3 = prompt(e1 + ", Please enter few numbers (maximum of 6) separated by commas", "1,2,3,4,5");
e6 = e3.split(',');
for(var a=0;a <= e6.length ;a++) {
e9=e9 + +e6[a];
}
document.write(e9) ;
However, what get's printed is NaN instead of the default sum of 15. Any ideas how to fix? Thank you.
Edit: Forgot to mention that i already had declared all my variables earlier.
var e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11;
Edit2: Here is my entire work in action. https://jsfiddle.net/nhz0Lnx8/
varand initializee9to0.var a = 0; e9 = 0;