var arr = [{'a':'daina', 'z':12},{'b':'john', 'y':22}, {'c':'alan','z':30}];
var arr2 = [{'c':'john', 'z':62}, {'d':'alana','s':32},  {'e':'mac','t':42}];
var finalArray = [];
for(var key2 in arr) {
  console.log(arr[key2]);
}
function compareKeys(arr,arr2){
  for(var key1 in arr2){
    for(var key in arr){
      if(key1 === key){
        finalArray = arr.splice(key,1);
      }
    }
  }
  for(var key in finalArray) {
    console.log(finalArray[key]);
  }
}
compareKeys(arr,arr2);
I am not getting what is wrong with the code. I want to remove 'c' property from 'arr' after comparing both 'arr' and 'arr2'. The 'c' property is same in both arrays so I want to remove it in my output. The output returned by the function should be {'a':'daina', 'z':12},{'b':'john', 'y':22}
Can anyone help me in comparing the properties of objects?
 
     
     
    