find object from array by max property - js
// https://stackoverflow.com/questions/39037005/get-object-from-array-by-max-property
var latest = values.reduce(function(l, e){
return l.startedate > e.startdate ? {value: l.value, startdate: l.startdate} : {value: e.value, startdate: e.startdate}
})
// function
function latest(values){
return values.reduce(function(l, e){
return l.startdate > e.startdate ? {value: l.value, startdate: l.startdate} : {value: e.value, startdate: e.startdate};
});
}