js map 2021-07-08
let obj = {}
arr.forEach((item) => {
if(obj[item. difficultyName]) {
obj[item. difficultyName] += item. number
} else {
obj[item. difficultyName] = item.number
}
})
Object.entrice(obj).map(([key,value]) => ({key:value}))
网友评论