Skip to content

Commit 38dbe04

Browse files
committed
Iteration ironhack-labs#3: Calculate the sum
1 parent 614fe0d commit 38dbe04

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

starter-code/src/functions-and-arrays.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ function findLongestWord(arr) {
2323
// Iteration #3: Calculate the sum
2424

2525
const numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10];
26+
function sumArray( arr ) {
27+
return arr.
28+
reduce( (acc, cur) => acc + cur );
29+
}
2630

2731
// Iteration #4: Calculate the average
2832
// Level 1: Array of numbers

0 commit comments

Comments
 (0)