Skip to content

Commit bf34ed1

Browse files
committed
iteration 6
1 parent 953745d commit bf34ed1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/functions-and-arrays.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,16 @@ function uniquifyArrayWithSet() {}
9494
// Iteration #6: Find elements
9595
const wordsFind = ['machine', 'subset', 'trouble', 'starting', 'matter', 'eating', 'truth', 'disobedience'];
9696

97-
function doesWordExist() {}
97+
function doesWordExist(wordArr, word) {
98+
return wordArr.includes(word);
99+
}
100+
101+
// console.log(doesWordExist(wordsFind, 'nope')); // false
102+
// console.log(doesWordExist(wordsFind, 'matter')); // true
103+
// console.log(doesWordExist([])); // null ??
104+
// console.log(doesWordExist(['machine'], 'machine')); // true
105+
// console.log(doesWordExist(['machine', 'poison', 'eat', 'apple', 'horse'], 'ratatouille')); // false
106+
// console.log(doesWordExist(['pizza', 'sandwich', 'snack', 'soda', 'book', 'computer'], 'book')); // true
98107

99108
// Iteration #7: Count repetition
100109
const wordsCount = [

0 commit comments

Comments
 (0)