In my code, there are two arrays of JSONs: one named products
and another called deletedProducts
.
The task is to filter out the products that are not present in the deletedProducts
array.
For instance:
products = [
{
id: 1,
name: 'Box'
},
{
id: 2,
name: 'Lamp'
}
]
deletedProducts = [
{
id: 1,
name: 'Box'
}
]
The filtered result would look like this:
result = [
{
id: 2,
name: 'Lamp'
}
]