To check if an array contains any element of another array in JavaScript, we use the some method.
For instance, we write
const arr1 = ["apple", "grape"];
const arr2 = ["apple", "banana", "pineapple"];
const found = arr1.some((r) => arr2.includes(r));
to call arr1.some with a callback that checks if the item being iterated through r is in arr1 is in arr2 with arr2.includes.
If the callback returns true, then some returns true.