I am NOT talking about concatenating elements together, but adding their values to another separate variable.
Like this:
var TOTAL = 0;
for (i=0; i<myArray.length; i++) {
TOTAL += myArray[i];
}
With this code, TOTAL doesn't add mathematically element values together, but it concatenates them next to each other, so if myArray[0] = "10" and myArray[1] = "10" then TOTAL will be "01010" instead of 20.
How should I write what I want?
Thanks