const target = { a: 1, b: 2 };
const source = { b: 4, c: 5 ,a:4};
console.log(target);
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 }
console.log(source);
image.png
网友评论