js 对象合并
Object.assign(obj1,obj2)
obj1为主对象,obj2为被合并对象
合并完成之后重复的键值对将被删除
const target = { a: 1, b: 2 };
const source = { b: 4, c: 5 };
const returnedTarget = Object.assign(target, source);
console.log(target);
// expected output: Object { a: 1, b: 4, c: 5 }
console.log(returnedTarget);
// expected output: Object { a: 1, b: 4, c: 5 }