Skip to content

Commit 16f5bee

Browse files
committed
Iteration ironhack-labs#3
1 parent debf160 commit 16f5bee

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/functions-and-arrays.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@ function findLongestWord(list1){
2424
return longestWord}
2525
}
2626
// Iteration #3: Calculate the sum
27+
28+
29+
2730
const numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10];
2831

2932

30-
function sumNumbers(array1){
33+
function sumNumbers(list1){
3134
let totalSum = 0;
32-
let listSize = array1.length;
35+
let listSize = list1.length
3336

34-
for(let i=0;i <listSize; i++){
35-
totalSum =totalSum + array1[0];
37+
for(let i=0;i<listSize;i++){
38+
totalSum +=list1[i]
3639
}
37-
return totalSum
38-
40+
return totalSum
3941
}
4042
// Iteration #4: Calculate the average
4143
// Level 1: Array of numbers

0 commit comments

Comments
 (0)