I have an array as following:
var arr = [
{
subArray1:[
{
subArray2:[
{
value: 1
},
{
value: 0
}
]
},
{
subArray2:[
{
value: 1
},
{
value: 0
}
]
}
]
}
];
I want to filter out all objects inside the subArray2 that contains value 1 and return the whole array. The expected output is as follows:
newArr= [
{
subArray1:[
{
subArray2:[
{
value: 1
}
]
},
{
subArray2:[
{
value: 1
}
]
}
]
}
]
I am unable to chain the map and filter methods in such a way that I get the above desired output. Please help me to achieve that.