For example, this syntax works as I tested it out on MDN.
I am trying to get the total field off of this object here, but I keep getting a bunch of errors.
Here is the object I am getting back. This is shown in advanced rest client.
How do I get the total value? I tried doing people[0].total, but it's not working as it throws errors.
I get this error:
Uncaught TypeError: Cannot read property 'total' of undefined
However, I tried doing this, and this return the correct value...
const helper= () => {
for (let prop in people) {
return people[prop].total;
}
}