i have a nested array of objects in which I need to add condition and remove objects.
const Items = [
{
A: 'title',
B: [],
C: [
{ item1: item1},
{ item2: item2 },
{ 'item3': item3},
{ 'item4': item4},
],
D: 'some value',
},
]
if my variable test is true i need below output else same as above
const test = true;// not always true
then I need my output as
const Items = [
{
A: 'title',
B: [],
C: [
{ item1: item1},
{ item2: item2 },
],
D: 'some value',
},
]
{ 'item3': item3},{ 'item4': item4}, should be removed