i have a 2 object which i wan't to make filtering with es6
first is my data object and second selected some data.
I wan't to get all items in data object which have second object values
let data = [
{
id: 1,
name: 'A',
status: 1
},
{
id: 2,
name: 'B',
status: 1
},
{
id: 3,
name: 'C',
status: 3
},
{
id: 4,
name: 'D',
status: 2
}
]
and second object is :
let selectedStatus = [
{
id: 1,
status: 1
},
{
status: 3
}
]
in this case i want't to get data object items which contains same statuses in second object so in this case i need to get this result:
data = [
{
id: 1,
name: 'A',
status: 1
},
{
id: 2,
name: 'B',
status: 1
},
{
id: 3,
name: 'C',
status: 3
},
]