weixin_33713350 2018-10-17 22:00 采纳率: 0%
浏览 37

从对象访问数组

I feel like this is a basic question but everything I try is not working. I am trying to access Arrays that are nested inside object.

When do console.log(response.data) I will get a Object with Arrays inside

{
  scanned: [],
  complete: [],
  received: [],
  review: [],
}

But if i then try to access one of the arrays with console.log(response.data.scanned) I will get undefined

My question is how do I access Arrays nested in Object? is this even possible?

*Update Here is the response I get with just console.log(response) enter image description here

Here is the response for console.log(response.data) enter image description here

Now if I try console.log(response.data['scanned']) it will still give me undefined

If I try console.log(response['data.scanned']) or console.log(response['data']['scanned']) will alse give me undefined

  • 写回答

1条回答 默认 最新

  • Memor.の 2018-10-18 01:33
    关注

    console.log(response.data.Scanned). Capital S

    评论

报告相同问题?