How can I sum the values in objects which share a common key? I need to use Lodash for this because I need good performance if these arrays get huge.
var prjMgrValues = [
{"proj_mgr":"Jack ProjManager","submitted_dollars":12000},
{"proj_mgr":"Jack ProjManager","submitted_dollars":750000},
{"proj_mgr":"Joe ProjManager","submitted_dollars":45000}
]
I'm looking for an output of
[
{"proj_mgr":"Jack ProjManager","submitted_dollars":762000},
{"proj_mgr":"Joe ProjManager","submitted_dollars":45000}
]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…