Skip to content

Commit 8231e3a

Browse files
committed
Iteration ironhack-labs#6
1 parent 51be67c commit 8231e3a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/functions-and-arrays.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,23 @@ function uniquifyArray(array){
115115
}
116116
}
117117
return uniquedArray;
118+
}
119+
120+
// ### Iteration #6: Find elements
121+
122+
// Let's create a simple array search.
123+
124+
// Declare a function named `doesWordExist` that will take in an array of words as one argument, and a *word to search* for as the other. Return `true` if the word exists in the array, otherwise, return `false`.
125+
126+
// You can use the following array to test your solution:
127+
128+
// ```javascript
129+
// const words = ['machine', 'subset', 'trouble', 'starting', 'matter', 'eating', 'truth', 'disobedience'];
130+
// ```
131+
132+
// <br>
133+
134+
function doesWordExist(words, searchWord){
135+
if (words.length === 0 ) return null
136+
return words.includes(searchWord) ? true : false;
118137
}

0 commit comments

Comments
 (0)