Skip to content

Commit 462c928

Browse files
author
Chris Weber
committed
1 parent 9555b4b commit 462c928

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/functions-and-arrays.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,23 @@ const wordsFind = [
153153
"disobedience",
154154
];
155155

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+
157173

158174
// Iteration #7: Count repetition
159175
const wordsCount = [
@@ -170,7 +186,11 @@ const wordsCount = [
170186
"matter",
171187
];
172188

173-
function howManyTimes() {}
189+
function howManyTimes(array) {
190+
if (array.length === 0) {
191+
return 0;
192+
}
193+
}
174194

175195
// Iteration #8: Bonus
176196
const matrix = [
@@ -238,7 +258,7 @@ const matrix = [
238258
],
239259
];
240260

241-
function greatestProduct() {}
261+
function greatestProduct(){}
242262

243263
// The following is required to make unit tests work.
244264
/* Environment setup. Do not modify the below code. */

0 commit comments

Comments
 (0)