I have 2 arrays
let arryOne =
[
{
'catRefId' : "200531-2"
},
{
'catRefId' : "201425-1"
},
{
'catRefId' : "201423-1"
},
]
let arryTwo =
[
{
'removeId' : "200531-2"
},
{
'removeId' : "201425-1"
},
]
I tried below code but not working
let _finalArray = [];
for (let index = 0; index < arryOne.length; index++) {
_finalArray = arryOne.filter(obj => obj.catRefId === arryTwo[index].removeId)
}
Array.find()instead. Or you first create a Set of ids to remove, then check is the set has() the id.