const base = [
{id: 1,name: 'A1'}, {id: 11,name: 'A11'},
{id: 12,name: 'A2'}, {id: 111,name: 'A111'},
{id: 112,name: 'A112'}, {id: 121,name: 'A121'},
{id: 122,name: 'A122'},
{id: 2,name: 'A2'},{id: 3,name: 'A3'},{id: 4,name: 'A4'}
];
const tree = [
{id: 1, parent:0, level: 'L1'},
{id: 11, parent:1, level: 'L2'},
{id: 111, parent:11, level: 'L3'},
{id: 112, parent:11, level: 'L3'},
{id: 12, parent:1, level: 'L2'},
{id: 121, parent:12, level: 'L3'},
{id: 122, parent:12, level: 'L3'},
]
i have two object one is base another one is tree. if i pass the 'id=11' it has to remove the [id:11]'s level 'L2' and its top level 'L1' id from the base object and result the remaining values. the below result am expecting
const result = [
{id: 111,name: 'A111'},
{id: 112,name: 'A112'}, {id: 121,name: 'A121'},
{id: 122,name: 'A122'},
{id: 2,name: 'A2'},{id: 3,name: 'A3'},{id: 4,name: 'A4'}
];
how to achieve this?

Vikas JhaRank #1,222 · 1.5K reputationPosted Sep 6, 2020, 6:28 AM EDT
Vikas JhaRank #1,222 · 1.5K reputationPosted Sep 5, 2020, 10:24 AM EDT
kasim mohamed69 reputationPosted Sep 6, 2020, 12:43 AM EDT
kasim mohamed69 reputationPosted Sep 6, 2020, 2:29 AM EDT
Vikas JhaRank #1,222 · 1.5K reputationPosted Sep 6, 2020, 2:03 AM EDT
Vikas JhaRank #1,222 · 1.5K reputationPosted Sep 6, 2020, 4:04 AM EDT
kasim mohamed69 reputationPosted Sep 6, 2020, 8:55 PM EDT
kasim mohamed69 reputationPosted Sep 6, 2020, 11:31 PM EDT
Laxmidhar SahooRank #383 · 6.6K reputationPosted Sep 6, 2020, 7:52 AM EDT
Vikas JhaRank #1,222 · 1.5K reputationPosted Sep 6, 2020, 9:00 PM EDT
If required you can share the data array and I can try to make code change and share with you.