File tree 1 file changed +23
-3
lines changed
1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,23 @@ const wordsFind = [
153
153
"disobedience" ,
154
154
] ;
155
155
156
- function doesWordExist ( ) { }
156
+ function doesWordExist ( arr , str ) {
157
+ if ( arr . length === 0 ) {
158
+ return null ;
159
+ }
160
+ for ( let i = 0 ; i < arr . length ; i ++ ) {
161
+ if ( arr [ i ] === str ) {
162
+ return true ;
163
+ }
164
+ }
165
+ return false ;
166
+ }
167
+
168
+
169
+
170
+
171
+
172
+
157
173
158
174
// Iteration #7: Count repetition
159
175
const wordsCount = [
@@ -170,7 +186,11 @@ const wordsCount = [
170
186
"matter" ,
171
187
] ;
172
188
173
- function howManyTimes ( ) { }
189
+ function howManyTimes ( array ) {
190
+ if ( array . length === 0 ) {
191
+ return 0 ;
192
+ }
193
+ }
174
194
175
195
// Iteration #8: Bonus
176
196
const matrix = [
@@ -238,7 +258,7 @@ const matrix = [
238
258
] ,
239
259
] ;
240
260
241
- function greatestProduct ( ) { }
261
+ function greatestProduct ( ) { }
242
262
243
263
// The following is required to make unit tests work.
244
264
/* Environment setup. Do not modify the below code. */
You can’t perform that action at this time.
0 commit comments