What I'm trying to do is read this array of objects below and from there build a list with the free values.
const data = [
{
"house01": {
"free": 6
},
"house02": {
"free": 2
},
"house03": {
"free": 1
},
}
]
console.log(data.map((item) => item.free))
Response
[undefined]
Expected response
[6, 2, 1]
What I don't understand is why the result doesn't go as expected.
const data = { houses: [{ "free": 6 }, { "free": 2 }] }with an additionalhouseIdproperty in each house object, if required