I have an object like this:
var items = {
foobar: {
foo: 'bar'
}
}
and I have the name 'foobar' in a value I receive when the user selects it in a form, like this:
var item = $('select').val(); // which is 'foobar'
How can I access items.foobar.foo
when I only know the name 'foobar' in that variable? It won't parse 'item' as a variable in items.item.foo
...
I guess it's kinda like doing $items[$item]['foo']
in PHP, but I have no idea how do do it in Javascript.
Thanks.