1console.log(
2 [1, 2, 3, 4].reduce((a, b) => a + b, 0)
3)
4console.log(
5 [].reduce((a, b) => a + b, 0)
6)
1function addSum(array) { // call the function with your array parameter
2 let solution = 0
3 for (let x = 0 ; x < array.length;x++) { // for loop
4 solution = solution + array[x]
5 }
6 return solution
7}
1function addArrayNums(arr) {
2 let total = 0;
3 for (let i in arr) {
4 total += arr[i];
5 }
6 return total;
7}