需求:把一个数组的每一项值加入到另外一个数组对象中
原数组:

转换为:

let arr = [{
id: "1",
name: "香蕉"
}, {
id: "2",
name: "苹果"
}];
console.log(arr)
let otherArr = ["好吃", "很好吃"];
arr.forEach((value, index) => {
value['evaluate'] = otherArr[index];
})
console.log(arr)

被折叠的 条评论
为什么被折叠?



