days[
{
dt:2017-06-19T00:00:00.000Z,
id:1,
releases:[],
},
{
dt:2017-06-20T00:00:00.000Z,
id:2,
releases:[{
id:41,
programId:2,
teamId:116,
}]
},
{
dt:2017-06-21T00:00:00.000Z,
id:3,
releases:[]
},
]
i want to delete the releases that have an id of 41 AND day.id of 2.. so my array should look like :
days[
{
dt:2017-06-19T00:00:00.000Z,
id:1,
releases:[],
},
{
dt:2017-06-20T00:00:00.000Z,
id:2,
releases:[]
},
{
dt:2017-06-21T00:00:00.000Z,
id:3,
releases:[]
},
]
i have tried to filter :
var found = days.filter(function(day){
return day.releases.filter(function(r){
return r.id===41
});
});
and then get the index and remove from there but i know there's a simpler way to do this.. can anyone help? There can be more than one releases in the nested releases object array so i need to specifically remove by looking at the release id and also the days id .