清华大佬ES
Object.assign 本质上是把source 覆盖到target 上
const source1 = { aaa: 'source-a', bbb: 'source-b' } const target = { aaa: 'target-a', ccc: 'target-c' } const result = Object.assign(target, source1); console.log('result :>> ', result); // result :>> { aaa: 'source-a', ccc: 'target-c', bbb: 'source-b' } console.log(target === result); // true