var array= [
{name: 'Rajat', messages: [{id: 1,message: 'Hello'},{id: 3,message:'Hello 2'}]},
{name: 'Himesh', messages: [{id: 2,message: 'Hello'}]},
{name: 'David', messages: [{id: 4,message: 'Hello'}]}
]
var filteredArray= array.filter(function(value)
{
if(value.name === 'Rajat')
{
return true;
}
else
return false;
})
return filteredArray[0].messages;
1
solved Javascript: get object value from Object [closed]