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
标签:清华,const,target,source,result,aaa,大佬,ES,log From: https://www.cnblogs.com/it-Ren/p/16821073.html