Having trouble extracting values from fields and have tried various methods like nesting the map
function and concatenating fields without success.
I have an object with a structure similar to this:
[{
name: 'sean',
age: 26,
address:
[{
street: 'red'
},
{
street: 'blue'
}]
}];
My goal is to extract the street value from this structure and store it in a new array. The desired result would be:
const newArray = ['red', 'blue'];
The address field may contain multiple objects, so the solution should be scalable for handling one or many objects.