Take the following data:
object {
name: 'foo'
children: [
{
'name': 'cat'
'color': 'green'
},
{
'name': 'dog'
'color': 'blue'
},
{
'name': 'bird'
'color': 'red'
}
]
}
How can I use Underscorejs, jQuery and JavaScript to find and select the child where name=dog? I tried using _.findWhere(objectdata.children,{name:'dog'}), but that didn't seem to work either.