Wanted to compare two arrays with objects and remove duplicate by its property name, I have these two:
arr1 = [{
item:"apple",
description: "lorem"
},{
item:"peach",
description: "impsum"
}]
arr2 = [{
item:"apple", description: "dolor"
},{
item:"grape", description: "enum"
}]
and I wanted this result:
arr3 = [{
item:"peach", description: "impsum"
},{
item:"grape", description: "enum"
}]
I've tried this es6 approach but not working arr3 = arr1.filter(val => !arr2.includes(val));