There are two array :
arr1 = [
{name: "gunner", id: 639, label: "group"},
{name: "Gunners", id: 1313, label: "channel", isPrivate: false}
]
arr2 = [
{name: "gunner", id: 639, label: "group"}
]
Need to remove all the values from arr1 which exists in arr2 ?
Final arr1 will be, as arr2 already has {name: "gunner", id: 639, label: "group"}:
arr1 = [
{name: "Gunners", id: 1313, label: "channel", isPrivate: false}
]
I tried this but doesn't work as expected.
arr1 = arr1.filter(function(val) {
return arr2.indexOf(val) == -1;
});