I am doing comparison between two arrays, I need to compare for each Array A 'id' with for each Array B 'id1'. If there is no match I need to pull out that particular object of Array A
Array - A
var A=[
{
"id": "xyz",
"number": "123",
"place": "Here",
"phone": "9090909090"
},
{
"id": "abc",
"number": "456",
"place": "There",
"phone": "9191919191"
},
]
Array - B
var B = [
{
"element1" : "ert",
"id1":"iii",
"element2":"erws",
"element3":"234"
}
,
{
"element1" : "uio",
"id1":"xyz",
"element2":"puy",
"element3":"090"
}
]
Using below -
var output = A.filter(x => B.some(y => x.id !== y.id1));
console.log(output);
Unable to perform inequality operation for the below code snippet. It is giving me complete Array A even though performing inequality operator Is anything I missing here
The output I am expecting here is
[{
"id": "abc",
"number": "456",
"place": "There",
"phone": "9191919191"
},
]
Please help me with the suggestions to make this work in javascript.