If the nested array is empty and I want to remove the object, how can I achieve this? For example, consider the following array:
pokemonGroups = [
{
name: 'Grass',
pokemon: [
'bulbasaur-0', 'Bulbasaur', 'oddish-1','Oddish','bellsprout-2', 'Bellsprout'
]
},
{
name: 'Water',
pokemon: [
]
}]
In this case, we have an empty array:
{
name: 'Water',
pokemon: []
}
To remove this object and update the array to:
pokemonGroups = [
{
name: 'Grass',
pokemon: [
'bulbasaur-0', 'Bulbasaur', 'oddish-1','Oddish','bellsprout-2', 'Bellsprout'
]
}
]