javascript array not includes code example

Example 1: typescript check if element in array

your_array.includes(the_element)

Example 2: check value exist in array javascript

[1, 2, 3].includes(2);     // true
[1, 2, 3].includes(4);     // false
[1, 2, 3].includes(1, 2);  // false (second parameter is the index position in this array at which to begin searching)

Example 3: react check if array contains value

console.log(['joe', 'jane', 'mary'].includes('jane')); //true

Example 4: javascript includes

const pets = ['cat', 'dog', 'bat'];

console.log(pets.includes('cat'));
// output: true

Example 5: array includes

let storyWords = ['extremely', 'literally', 'actually', 'hi', 'bye', 'okay']
let unnecessaryWords = ['extremely', 'literally', 'actually' ];

let betterWords = storyWords.filter(function(word) {
  return !unnecessaryWords.includes(word);
});
console.log(betterWords) // ['hi' 'bye' 'okay]

Example 6: javascript includes method

arr.includes(searchElement[, fromIndex = 0])