1function getArraySum(arr) {
2 let total = 0; i = arr.length;
3 while(i--) total += arr[i];
4 return total;
5}
6var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
7getArraySum(numbers);
8
1//Getting One Value from an Array of Items or sum of array
2var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
3var total = numbers.reduce(function(total, current) {
4 return total + current;
5}, 0);
6
7console.log(total);