We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 78add35 commit 0bf9f86Copy full SHA for 0bf9f86
src/functions-and-arrays.js
@@ -168,7 +168,22 @@ const wordsCount = [
168
'matter'
169
];
170
171
-function howManyTimes() {}
+function howManyTimes(arrOfWords, wordToSearch) {
172
+ if (!arrOfWords.length) return 0;
173
+
174
+ let wordCount = 0;
175
176
+ arrOfWords.forEach((word, i) => {
177
+ let currentWord = arrOfWords[i];
178
179
+ if (currentWord === wordToSearch) {
180
+ wordCount += 1;
181
+ }
182
+ });
183
184
+ return wordCount;
185
186
+}
187
188
189
0 commit comments