Skip to content

Commit 26796c6

Browse files
committed
ironhack-labs#4 level 2 done
1 parent 29fe530 commit 26796c6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/functions-and-arrays.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ function averageNumbers(arr) {
5858
// *Level 2: Array of strings
5959
const wordsArr = ['seat', 'correspond', 'linen', 'motif', 'hole', 'smell', 'smart', 'chaos', 'fuel', 'palace'];
6060

61-
function averageWordLength() { }
61+
function averageWordLength(arrWords) {
62+
let wordsAvarege = 0
63+
for (let i = 0;i < arrWords.length; i++){
64+
wordsAvarege += arrWords[i].length
65+
}
66+
return (wordsAvarege / arrWords.length)
67+
}
6268

6369
// Bonus - Iteration #4.1
6470
function avg() {}

0 commit comments

Comments
 (0)