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 fa464f2 commit 47e7cf5Copy full SHA for 47e7cf5
src/functions-and-arrays.js
@@ -163,7 +163,21 @@ const wordsCount = [
163
"matter",
164
];
165
166
-function howManyTimes() {}
+function howManyTimes(wordArray, wordToSearch) {
167
+ if (wordArray.length == 0) {
168
+ return 0;
169
+ } else {
170
+ i = 0;
171
+ count = 0;
172
+ while (i < wordArray.length) {
173
+ if (wordArray[i] === wordToSearch) {
174
+ count++;
175
+ }
176
+ i++;
177
178
+ return count;
179
180
+}
181
182
// Iteration #8: Bonus
183
const matrix = [
0 commit comments