Skip to content

Commit 8a9bbcb

Browse files
committed
add solution ironhack-labs#6
1 parent d9cf49d commit 8a9bbcb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/functions-and-arrays.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,17 @@ function uniquifyArray(input) {
111111
// Iteration #6: Find elements
112112
const wordsFind = ['machine', 'subset', 'trouble', 'starting', 'matter', 'eating', 'truth', 'disobedience'];
113113

114-
function doesWordExist() {}
114+
function doesWordExist(arrToSearch, searchedWord) {
115+
if (!arrToSearch || arrToSearch.length === 0) {
116+
return null;
117+
}
118+
for (let word of arrToSearch) {
119+
if (word === searchedWord) {
120+
return true;
121+
}
122+
}
123+
return false;
124+
}
115125

116126
// Iteration #7: Count repetition
117127
const wordsCount = [

0 commit comments

Comments
 (0)