Skip to content

Commit 0fb5469

Browse files
committed
Complete: Iteration ironhack-labs#3
1 parent 29179a3 commit 0fb5469

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/functions-and-arrays.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,19 @@ function findLongestWord(words) {
1616

1717
return longestWord ? longestWord : null;
1818
}
19-
console.log( findLongestWord(words) );
2019

2120

2221

2322
// Iteration #3: Calculate the sum
2423
const numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10];
2524

26-
function sumNumbers() {}
25+
function sumNumbers(numbers) {
26+
let sum = 0;
27+
for ( let number of numbers ) {
28+
sum += number;
29+
}
30+
return sum;
31+
}
2732

2833

2934

0 commit comments

Comments
 (0)