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 cd43119 commit 153151bCopy full SHA for 153151b
src/functions-and-arrays.js
@@ -163,7 +163,25 @@ const wordsCount = [
163
'matter'
164
];
165
166
-function howManyTimes() {}
+function howManyTimes(arr, wordToCount) {
167
+ const isEmptyArr = arr.length === 0;
168
+ if (isEmptyArr) {
169
+ return 0;
170
+ } else {
171
+ if (doesWordExist(arr, wordToCount)) {
172
+ let wordCounter = 0;
173
+ for (word of arr) {
174
+ const isToFindingWord = wordToCount === word;
175
+ if (isToFindingWord) {
176
+ wordCounter++;
177
+ }
178
179
+ return wordCounter;
180
181
182
183
184
+}
185
186
// Iteration #8: Bonus
187
const matrix = [
0 commit comments