how to check if an array contains values from another array in javascript code example
Example 1: javascript array includes another array
const array1= ["cheese", "dough", "sauce", "pepperoni"]
const array2= ["mozzarella", "peppers", "chicken", "cheese"]
const isIncluded = array1.some(value => array2.includes(value))
// true
const values = array1.filter(value => array2.includes(value))
// "cheese"
Example 2: if array ontains any item of another array js
const found = arr1.some(r=> arr2.indexOf(r) >= 0)