I am looking to collect all the Model Objects from the data structure provided below.
const PRODUCTS = [
{
brand: 'Audi',
allSeries: {
serie: 'A3',
allModels: [
{ model: 'A3 1.5 Sportback' },
{ model: 'A3 2.0 TDI' }
]
}
},
{
brand: 'Volkswagen',
allSeries: {
serie: 'Golf',
allModels: [
{ model: 'Golf 1.5' },
{ model: 'Golf 2.0' }
]
}
}
]
My goal is to combine all the model objects into one array structured like
[{model:'Golf 1.5}, {...}, {...}]
.