Skip to content

Commit e56798c

Browse files
committed
solved iteration ironhack-labs#7
1 parent e9d60c8 commit e56798c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/functions-and-arrays.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,19 @@ const wordsCount = [
159159
'matter'
160160
];
161161

162-
function howManyTimes() {}
162+
function howManyTimes(words, wordToSearchFor) {
163+
if (words.length === 0){
164+
return 0
165+
}
166+
167+
let repetitionCounter = 0
168+
for (word of words) {
169+
if(word === wordToSearchFor){
170+
repetitionCounter++
171+
}
172+
}
173+
return repetitionCounter
174+
}
163175

164176

165177

0 commit comments

Comments
 (0)