For example, I have 2 arrays:
arr1 = ["a","e","i","o","u"];
arr2 = ["h", "e", "l", "l", "o"];
I would like to find whether any of the elements in arr2 contain any of the elements that are already available in arr1.
Use Array.some to check whether one of the items in arr2 is included in arr1:
arr1 = ["a", "e", "i", "o", "u"];
arr2 = ["h", "e", "l", "l", "o"];
const res = arr2.some(e => arr1.includes(e))
console.log(res)
Find the array with below filter function
let array1 = ["a","e","i","o","u"];
let array2 = ["h", "e", "l", "l", "o"];
const filteredArray = array1.filter(value => array2.includes(value));
filteredArray.length will give you the answer
.some instead of filter.
arr1 = ["a","e","i","o","u"];Please edit your question to fix the code.