I have 2 arrays of objects with ids:
const oldOffers = [
{
_id: "1"
},
{
_id: "2"
},
{
_id: "3"
}
];
const activeOffers = [
{
_id: "1"
},
{
_id: "5"
}
];
I need to have a new array with objects that are present in oldOffers but are not present in activeOffers; so output will be:
filteredOffers = [{
_id: "2"
},
{
_id: "3"
}
];
I solved this problem using 2 loops but in bad way, have someone any elegant solution, also that uses lodash?