I have two JS objects:
var first = [{name: "Sam", group: "test"}, {name: "John", group: "it"}];
var second = [{name: "John", group: "it"}, {name: "Tim", group: "hr"}];
for (var k = 0; k < first.length; k++) {
if (first.indexOf(second[k]) == -1) {
console.log('found');
}
}
I am trying to filter out a value that is present at first, but missing at second. How can I do that?
Ideal return value: {name: "Sam", group: "test"}
Tried many things, nothing works at the moment. For example:
secondarray, none of the objects share any common values.