how can i have a total in a for loop javascript code example
Example: js for loop plus number
var nums = ['100','300','400','60','40'],
sum = nums.reduce(function(accum, val) {return accum + Number(val);}, 0);
alert(sum);
var nums = ['100','300','400','60','40'],
sum = nums.reduce(function(accum, val) {return accum + Number(val);}, 0);
alert(sum);