Using lodash to find the difference between two arrays:
c1Arr contains:
[ { varName: 'city', varValue: 'cccccccc' },
{ varName: 'country', varValue: 'dddddddd' }
]
c2Arr contains:
[ { varName: 'abc', varValue: 'aaa' },
{ varName: 'city', varValue: 'cccccccc' },
{ varName: 'country', varValue: 'dddddddd' }
]
When running this code snippet:
var dArr = _.difference(c2Arr, c1Arr);
console.log(dArr);
Instead of getting the expected result:
[ { varName: 'abc', varValue: 'aaa' }]
I am getting (i.e. c2Arr in total):
[ { varName: 'abc', varValue: 'aaa' },
{ varName: 'city', varValue: 'cccccccc' },
{ varName: 'country', varValue: 'dddddddd' }
]