Similar to this question and this question, i have an array of objects which I want to compare and then get the difference between these two. Sadly, my objects do not contain a ID (And at the state where I need to call the function, I also can't just give an ID to the Objects.).The examples i linked above rely on using the objects id for comparison, so I can't use these solutions. My arrays look like this:
var array1 = [{person1ID: 46, person2ID: 47, value: "test"}, {person1ID: 38, person2ID: 56, value: "test2"}];
var array2 = [{person1ID: 46, person2ID: 47, value: "test"}];
In this example, I would like to get the Object {person1ID: 38, person2ID: 56, value: "test2"}
, as this is in array1 but not in array2.
Is there any way I can compare the two arrays and get the difference if the objects in the array do not have an ID?