【ES6学习笔记之】Object.assign()

https://www.jianshu.com/p/d5f572dd3776

数组的扩展,两个数组的合并

const target = { a: 1 };

const source1 = { b: 2 };
const source2 = { c: 3 };

Object.assign(target, source1, source2);
target // {a:1, b:2, c:3}

  

猜你喜欢

转载自www.cnblogs.com/llllpzyy/p/11751177.html
今日推荐