Access data from an object js [closed]

1

I have the following JS object displayed by console.log

Icanonlyaccessthepropertystatusoftheobjectitself,butIneedtoaccessthestatuspropertythatisinsidethevalueobjectandhasthevalue400,butalltypesofpropertyadvisorsItrygiveundefinedwhenItrytogobeyondthefirststatus(ofvalue0)displayed.Cansomeonehelpme?Iwouldalsoliketoknowwhatthenameisforthese"internal" properties of the object?

    
asked by anonymous 01.08.2018 / 22:17

1 answer

3

As bfavaretto said you see the time you are accessing the data, as it may not yet be available, but the syntax is this as in the example. You have a data object, which to access any of your properties just put . before the property. In your case, the image does not have any array otherwise you would have to access the property index to get its value:

var dados = {
  pure: true,
  status: 2,
  value: {
    data: "",
    status: 400,
    headers: "bla-bla-bla"
  }
}

console.log(dados.status +" - "+ dados.value.status );
    
01.08.2018 / 22:37