I have this array of object
[{
id: 1,
checked: true,
subChild: [{
id: 11,
checked: true
}]
},
{
id: 2,
checked: true,
subChild: [{
id: 22,
checked: false
}]
},
{
id: 3,
checked: false,
subChild: [{
id: 33,
checked: true
}]
}]
is there any lib to get the id base on the checked property? I can use loop through it using filter
and find
method but it will be a lot of manual work, imagine I have another level of nested array of object.
expected output: [1, 11, 2, 33]