var arr = [10,20,30];
//计数器思想
var sum = 0;
for(var i=0;i<arr.length;i++){
sum += arr[i];
}
console.log(sum);
var avg = sum/arr.length;
console.log(avg);
var arr = [10,20,30];
//计数器思想
var sum = 0;
for(var i=0;i<arr.length;i++){
sum += arr[i];
}
console.log(sum);
var avg = sum/arr.length;
console.log(avg);