Well if you want just the total output at the end then you need to log total to the console after the loop. Based on my understanding of what you want to do I think something like the following is all that’s needed…
function hello() {
var arr = [];
for (var i = 0; i < 10; i++) {
arr.push(prompt('Enter number' + (i+1)));
}
var total = 0;
for(i=0; i<arr.length; i++) {
var number = parseInt(arr[i], 10);
total += number;
}
console.log(total);
}
3
solved add array together, display sum [duplicate]