-6

I have a script and where i get some objects and don't access them using some of my code's. Say the output is- response.

Objects:

0 : Object
    created_time : "2010-08-24T06:21:00+0000"
    id : "some_id"
    name : "Name"
__proto__ :  Object
1 : Object
2 : Object

I want to access the id, but can't access it.

My Code:

response.id

But gives me undefined.

Murad Hasan
  • 9,418
  • 2
  • 19
  • 40

1 Answers1

4

response appears to be an array. There isn't a single name property to be accessed, but (presumably) one for each item in the array:

console.log(response[0].name);
console.log(response[1].name);

etc...

David Hedlund
  • 125,403
  • 30
  • 199
  • 217