Min Wartość obiektu w tablicy
var list = [
{
'id':4,
'name':'nitin',
'group':'angularjs'
},
{
'id':1,
'name':'nitin',
'group':'angularjs'
},
{
'id':2,
'name':'nitin',
'group':'angularjs'
},
{
'id':3,
'name':'nitin',
'group':'angularjs'
}];
var result = list.reduce(function(res, obj) {
return (obj.id < res.id) ? obj : res;
});
console.log(result);
Run code snippetHide results
Gifted Gentoo