我有2個JSON投入使用兩條JSONs:的Javascript:合併基於其他字段
[
{
userId: 32159,
userFirstName: "john",
userLastName: "doe",
plans: [ ]
},
{
userId: 32157,
userFirstName: "dave",
userLastName: "mess",
plans: [ ]
}
]
和
[
{
userId: 32159,
userFirstName: "john",
userLastName: "doe",
results: [ ]
},
{
userId: 32157,
userFirstName: "dave",
userLastName: "mess",
results: [ ]
}
]
,我想輸出爲:
[
{
userId: 32159,
userFirstName: "john",
userLastName: "doe",
plans: [ ],
results: [ ]
},
{
userId: 32157,
userFirstName: "dave",
userLastName: "mess",
plans: [ ],
results: [ ]
}
]
如何在javascript.Please幫助。這裏userId是一個獨特的領域
你只是想簡單地添加2套? – IProblemFactory
我們可以假設數組的大小相同嗎?這些人是否被分類? – IProblemFactory