标签:log console turn 转换 ret badge ice 数组 digital
let arr = [{
"code": "badge",
"priceList": [{
"amount": 3000
}]
},
{
"code": "DigitalPhoto",
"priceList": [{
"amount": 1990
}]
}
]
let arr2 = arr.reduce((pre,cur)=>{
pre[cur.code] = cur.priceList
return pre
},{})
console.log(arr2)
打印结果:
{ badge: [ { amount: 3000 } ],
DigitalPhoto: [ { amount: 1990 } ] }
标签:log console turn 转换 ret badge ice 数组 digital
原文地址:https://www.cnblogs.com/qiyc/p/9288512.html