3 ms·
Also using underscore, with sortBy: _.chain(people) .sortBy(function(person) { return person.firstName.length + person.lastName.length; }) .
by wooby 15y ago
Also using underscore, with sortBy:
_.chain(people)
.sortBy(function(person) {
return person.firstName.length + person.lastName.length; })
.last()
.value()
- mhansen 15y agoFYI, this isn't as general, but I think it shows off underscore quite nicely: _(people).max(function(person) { return person.firstName.length + person.lastName.length; });