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);
2022-05-15 20:44:07
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);