Skip to content

Commit 1ffbdc1

Browse files
committed
Finished iteration ironhack-labs#6.
1 parent fd6c3fa commit 1ffbdc1

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/functions-and-arrays.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,22 +151,24 @@ function uniquifyArray() {
151151
wordsUnique.splice(i + 1, 1);
152152
}
153153
}
154-
155-
156154
console.log(wordsUnique)
157-
return wordsUnique
158-
159-
160-
155+
return wordsUnique
161156
}
162157

163158

164159

165160
// Iteration #6: Find elements
166-
const wordsFind = ['machine', 'subset', 'trouble', 'starting', 'matter', 'eating', 'truth', 'disobedience'];
167-
168-
function doesWordExist() { }
161+
// const wordsFind = ['machine', 'subset', 'trouble', 'starting', 'matter', 'eating', 'truth', 'disobedience'];
169162

163+
function doesWordExist(wordsFind, word) {
164+
if (wordsFind.length === 0) {
165+
return null
166+
} else if (wordsFind.includes(word) === true) {
167+
return true
168+
} else if (wordsFind.includes(word) === false) {
169+
return false
170+
}
171+
}
170172

171173

172174
// Iteration #7: Count repetition

0 commit comments

Comments
 (0)