I'm pulling data from a service that loads into a dropdown and when a value is selected it's being assigned to a variable and an example is below
[{
"id": 482,
"firstName": "Micheal",
"lastName": "Bamford",
"email": "[email protected]",
"areaCodes": [
{
"id": 60,
"name": "New York",
"status": "ACTIVE",
"createdDate": "2018-10-30 14:09:28"
},
{
"id": 12,
"name": "Florida",
"status": "ACTIVE",
"createdDate": "2018-10-30 14:09:28"
}
],
"createdDate": "2019-01-03 12:29:33"
}]
What i'm trying to achieve is to only get the name property in the areaCodes objects like this ['New York', 'Florida']
Below is the code i'm using so far which only gets me only the first in the array
const selected = this.listFromAPI.filter(t => t.id === ev.id).map(r=> r.areaCodes[0].name);