I have an object that contains an array list of objects. I'd like to get the value of an object within the array list.
example
var data = {
items1: [{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }],
items2: [{ id: 3, name: 'foo' }, { id: 4, name: 'bar' }]
};
I'm trying to access the name of id:1 in array list items1.
I thought it would be something like
data['items1']['id'].name
but I think I'm missing something. Anybody know what I might be doing wrong