javascript array includes on array of objects code example

Example 1: 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 2: check if property has value in array javascript

const magenicVendorExists =  vendors.reduce((accumulator, vendor) => (accumulator||vendor.Name === "Magenic"), false);