I have data that is structured like the following:
const arr = [{
id: 0,
name: 'Biomes',
icon: 'mdi-image-filter-hdr',
isParent: true,
children: [{
id: 1,
name: 'Redwood forest',
icon: 'mdi-image-filter-hdr'
}]
},{
id: 2,
name: 'Trees',
icon: 'mdi-pine-tree',
children: [{
id: 8,
name: 'Redwood',
icon: 'mdi-pine-tree'
}]
}];
The top level is an array of objects, and each object can have a child field children which itself can be an array of objects. If I know the value of id, how can I find the object (or more importantly the object name), based on that id value?