题解 | #数组求和#
数组求和
https://www.nowcoder.com/practice/cc3ce199461c4c4cb8f63db61d7eba30
function sum(arr) {
var sum = 0;
for(var i = 0 ;i<arr.length;i++){
sum += arr[i]
}
return sum
}
var sum = 0;
for(var i = 0 ;i<arr.length;i++){
sum += arr[i]
}
return sum
}