1function getArraySum(a){
2 var total=0;
3 for(var i in a) {
4 total += a[i];
5 }
6 return total;
7}
8
9var payChecks = [123,155,134, 205, 105];
10var weeklyPay= getArraySum(payChecks); //sums up to 722
1 function array(arr){
2 var sum = 0;
3 for (var i = 0; i< arr.length; i++){
4 sum += arr[i];
5 }
6 console.log(sum);
7 }
8 array([5, 1, 3, 3])
9