Chartjs-How to subscribe to elements in a response object

0👍

so if your response is an array containing one object, you should do something like
res[0].zones.map((res) => res.zoneName)
to get the names of the zones.

However if your response is an array of objects (containing more than one) then you should also loop on it. E.g:

let zoneNames = []
res.forEach(entry => {
   const zoneNamesTemp = entry.zones.map(zone => zone.zoneName)
   zoneNames = [...zoneNames, ...zoneNamesTemp]
})

Leave a comment