-1

问题描述

let arr1 = [
  {abc:"name"},
  {abc:"content"}
]
let arr2 = [
  {0:"111",1:"222"},
  {0:"333",1:"444"}
]

你期待的结果是什么?

let arr3 = [
  {name:"111",content:"222"},
  {name:"333",content:"444"}
]
Evie 13
2019-03-25 提问

查看全部 2 个回答

1

已采纳
const arr3 = arr2.map(i=>{
  const obj = {}
  for(var j in i){
    obj[arr1[j].abc]=i[j]
  }
  return obj
})

推广链接