Skip to content
Advertisement

Tag: matching

Check if arrays contain shared elements regardless of index

I’d like to check if two arrays share elements regardless of order. Given Will return matches for ‘hello’, ‘how’, and ‘are’ There seems to be something for PHP, array_intersect() (Check if array contains elements having elements of another array), but nothing for JavaScript. I would use in if the values were in an object, but they are not: I could

Advertisement