JSFiddle - React, Tailwind, and code Playground
JavaScript
var array1 = [{'578': '2'}, {'123': '18'}, {'323': '5'}];
var array2 = [{'123': '18'}, {'578': '1'}, {'323': '3'}];
var removed = exists = [];
for(var k in array2){
var found = k;
for(var x in array2){
if(JSON.stringify(array2[k]) == JSON.stringify(array1[x])){
found = true;
break;
}
}
if(found !== true){
removed.push(array2[found]);
}
}
array2 = removed;
console.log(array2);