对象数组为id添加金额

时间:2016-09-27 07:13:07

标签: javascript arrays json object

我的问题是如何通过id创建其他数组来正确添加对象数组的值,例如,我有:

var array = [{"key":"1","amount":200},{"key":"2","amount":200},{"key":"1","amount":200}];

var resultArray=[{"key":"1","amount":400},{"key":"2","amount":200}]

0 个答案:

没有答案