Object.assign方法
Object.assign(目标对象,源对象)
用于将所有可枚举属性的值从一个或多个源对象复制到目标对象,返回目标对象
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 }

浙公网安备 33010602011771号