qq_26013261
qq_875143287
采纳率100%
2019-09-20 16:39

js如何拼接对象相同的数组

已采纳
有以下3个数组
arry1{
create_user: "a"
data: 3
department: "a"
engineers: "a"
evaluate_userlist: "a"
hosp_name: "a"
id: "a"
inner_status: "a"
manager_id: "a"
manager_idlist: "a"
}
arry2{
id: 86
isAdmin: false
mobile: "15757116643"
name: "minjiezhao"

}
arry3{
engineers: "22我是"
evaluate_userlist: "1"
hosp_name: "大华医院"

}
需要生成的数组

arry4{
create_user: "a"
data: 3
department: "a"
engineers: "22我是"
evaluate_userlist: "1"
hosp_name: "大华医院"
id: "86"
inner_status: "a"
manager_id: "a"
manager_idlist: "a"
}

等于是把其他不同数组的相同的对象名字,赋值给第一个数组,需要去重判断,有些在多个数组中都有。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • jslang 天际的海浪 2年前

    var arry4 = Object.assign({},arry1,arry2,arry3);

    点赞 1 评论 复制链接分享

相关推荐