_ = require('lodash');
//var async = require('async');
//var asyncSave = require('asyncSave');
var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
let a = _.sumBy(objects,function(o){ return o.n })
console.info(a)// 20
let b = _.sumBy(objects,'n')
console.info(b)// 20
标签:info,数字,require,运算符,objects,sumBy,var
From: https://www.cnblogs.com/pansidong/p/16996372.html