1var string = "foo",
2 substring = "oo";
3
4console.log(string.includes(substring));
1const pets = ['cat', 'dog', 'bat'];
2
3console.log(pets.includes('cat'));
4// output: true
1const array1 = [1, 2, 3];
2
3console.log(array1.includes(2));
4// expected output: true
5
6const pets = ['cat', 'dog', 'bat'];
7
8console.log(pets.includes('cat'));
9// expected output: true
10
11console.log(pets.includes('at'));
12// expected output: false
1[1, 2, 3].includes(2); // true
2[1, 2, 3].includes(4); // false
3[1, 2, 3].includes(3, 3); // false
4[1, 2, 3].includes(3, -1); // true
5[1, 2, NaN].includes(NaN); // true
1let storyWords = ['extremely literally actually hi bye okay']
2let unnecessaryWords = ['extremely', 'literally', 'actually' ];
3
4let betterWords = storyWords.filter(function(word) {
5 return !unnecessaryWords.includes(word);
6});
7console.log(betterWords) // ['hi' 'bye' 'okay]