There are two object arrays available:
first = [
{ "id": "15", "name": "raza" },
{ "id": "1", "name": "sahir" },
{ "id": "54", "name": "ayyan" },
{ "id": "3", "name": "tahir" },
];
second = [
{ "id": "15", "name": "razi" },
{ "id": "3", "name": "qasim" },
{ "id": "1", "name": "taha" },
];
The goal is to extract unmatched objects from the "first" array based on their id, using the following code:
const result = this.first.filter(e => this.second.some(({id}) => e.id == id ));
The current code retrieves matched objects, but the requirement is to obtain only the unmatched objects.