_.maxBy(array, [iteratee=_.identity])
这个方法类似_.max 除了它接受 iteratee 来调用 array中的每一个元素,来生成其值排序的标准。 iteratee 会调用1个参数: (value) 。
varobjects= [{ 'n': 1 }, { 'n': 2 }]; _.maxBy(objects, function(o) { returno.n; }); // => { 'n': 2 }