I have these two arrays
arr1 = ["dog", "cat", "bird"]
arr2 = ["fish", "bear", "bird"]
I have found a good way to do this:
(arr1 & arr2).any?
& is a logic operator, if some elements exist in both arrays, this will return these elements.
any? checks if any elements exist in the array. If there exists at least one, then it return