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 092f412 commit 2830873Copy full SHA for 2830873
src/functions-and-arrays.js
@@ -166,6 +166,20 @@ const wordsCount = [
166
'matter'
167
];
168
169
+// function howManyTimes (wordsArr, wordSearch) {
170
+// return wordsArr.filter( a => a == wordSearch).length
171
+// }
172
+
173
+ function howManyTimes (wordsArr, wordSearch) {
174
+ let count = 0
175
+ for (let i=0; i < wordsArr.length; i++) {
176
+ if ( wordSearch == wordsArr[i]) {
177
+ count += 1
178
+ }
179
180
+ return count;
181
182
183
// Iteration #8: Bonus
184
185
const matrix = [
0 commit comments