Reputation: 31
I need to remove vegetables from this object
"shop":
{
"items":
{
"fruits" : [],
"vegetables" :[]
}
}
}
i tried deleting by "delete shop.items.fuits"... but it didnot work
Upvotes: 2
Views: 52
Reputation: 816
It seems to be working...
const o = { a: { b: { c: [], d: 4 } } }
delete o.a.b.c
console.log(o)
.as-console-wrapper { max-height: 100% !important; top: 0; }
Upvotes: 1