📜  合并 2 个具有相同键的字典 javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:32.740000             🧑  作者: Mango

代码示例2
const target = { a: [1], b: [2] };
const source = { a: [2], c: [5] };

const returnedTarget = Object.assign(target, source);

for(var date in source)
target[date] = [...target[date] || [],...source[date]]

console.log(target);