All I need to do is compare two arrays of objects and remove items in the second one that have the same property value. For example:
var a = [{\'name\':\'bob
You just need to break the inner loop when a match is found:
if (a[i].name == b[j].name) {
b.splice(j, 1);
break;
}
compare and remove in array of object.Typically array of object data type may be typeOf is object.So that we need to convert into JSON stringify and then check condition..
for(var i=0; i < a.length; i++) {
for(var j=0; j < b.length; j++) {
if(JSON.stringify(a[i]) == JSON.stringify(b[j])) {
a.splice(i, 1);
}
}
}