Skip to content

Commit 8b42798

Browse files
committed
Iteration ironhack-labs#3
1 parent ed6c2a2 commit 8b42798

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/functions-and-arrays.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@ function findLongestWord(anArr) {
2828
return longestWord
2929
}
3030

31-
3231
// Iteration #3: Calculate the sum
3332
const numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10];
3433

35-
function sumNumbers() {}
36-
37-
34+
function sumNumbers(anArr) {
35+
let total = 0
36+
37+
for (let i = 0; i < anArr.length; i++){
38+
total += anArr[i]
39+
}
40+
return total
41+
}
3842

3943
// Iteration #3.1 Bonus:
4044
function sum() {}

0 commit comments

Comments
 (0)