两个数组合并的问题?
发布于 4 年前 作者 juandeng 12973 次浏览 来自 问答

array1:[{title:“张三”,age:“18岁”},{title:“李四”,age:“20岁”}]

array2:[{sc:“111只”},{sc:“10只”}]

如何合并成

c:[{title:“张三”,age:“18岁”,sc:“111只”},{title:“李四”,age:“20岁”,sc:“10只”}]

2 回复
const c = array1.map((item, index) => ({...item, ...array2[index]}))

这么简单都不会?

回到顶部