const find = (arr, pattern) => pattern.filter(a => arr.includes(a)).shift(); const arr = ["asdlkfjhasjd", "Яблоко", "adfkljahsdj", "Банан"]; const pattern = ["Банан", "Яблоко"]; let item = find(arr, pattern); alert(item);