Suppose I have two arrays containing objects as follows:
var array1 = [{"key1":"value1"}, {"key2":"value2"}, {"key3":"value3"}],
array2 = [{"key4":"value4"}, {"key1":"value1"}, {"key5":"value5"}]
(please note that the structure of objects can vary)
What is the most effective method to extract all the objects that exist in both arrays?
I came across a similar question here: Finding matches between multiple JavaScript Arrays, but it doesn't exactly address my concern...