var data = { neibie1: [ { expensedate: '6月', amount: 40 }, { expensedate: '6月', amount: 30 }, { expensedate: '5月', amount: 10 }, { expensedate: '5月', amount: 60 }, ] } console.log(Object.values(data.neibie1.reduce((res, item) => { var ex = res[item.expensedate] if(ex) { ex.amount.push(item.amount) } else { res[item.expensedate] = { expensedate: item.expensedate, amount: [item.amount] } } return res; }, {})))提问题不要只贴图,那么长串数据要回答的人手打?
提问题不要只贴图,那么长串数据要回答的人手打?