let testData=[{
num:45,
name:'第一'
},{
num:23,
name:'第二'
},{
num:12,
name:'第二'
}];
let data=[0,12,45]
let test= testData.reduce((a,b)=>{
return a+b.num // 注意是b的参数
},0)
let dd=data.reduce((a,b)=>{
return a+b
})
console.log(test); //80
console.log(dd); //57
网友评论