I have this array :
this.menuItems = [
{
category: 'category 4',
items: [
{
type: 'link',
icon: '',
},
{
type: 'link',
icon: '',
},
]
},
{
category: 'category 1',
items: [
{
type: 'text',
icon: 'pencil'
},
{
type: 'checkbox',
icon: 'pencil'
},
]
},
I want to delete the object from menuItems that have type = checkbox.
I tried like this :
this.menuItems.forEach(category => {
category.items.forEach((item, index) => {
if (item.type === 'checkbox') {
category.splice(index, 1);
}
});
});
But not working. Can you help me please with some advices ? Thx in advance
type : checkboxproperty .. Can you recheck the data?