I have 2 arrays with a similar structure as shown below. My objective is to compare each field and store the items from the arrays that differ in a third array.
Arr1= [{ state:CA, id:1, name:aaa, product:car, color: white}, {...}]
and so forth
Arr2= [{ id:1, name:bbb, product:car, color: white, mileage:30, type: sedan}, {...}]
and so on
Arr3= [{ state: CA, id:1, name:aaa, product:car, color: white}],
Error/result/difference = name (something along those lines)
The goal is to use the combination of id, make, product, and color as a key field for comparison with the second array. If there is a difference in any of these fields, then the entire object should be added to the third array.
Note: These two arrays have different sets of key-value pairs, with only a few common ones. The aim is to compare these common elements in each object in Arr1 with every object in Arr2, highlighting any differences.
Note#2: I am not interested in finding missing objects in either array; my focus is solely on identifying matching objects with perhaps one mismatched key value among the common keys.
The proposed solution does not align with my query. I hope I have clarified it adequately.