Object.assign(target,...sources)

The Object.assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object.
It will return the target object.

target
The target object.
sources
The source object(2).

Return value
The target object.

var obj = { a: 1 };
var copy = Object.assign({}, obj);
console.log(copy); // { a: 1 }

Object.assign()

通过复制一个或多个对象来创建一个新的对象。

你可能感兴趣的:(Object.assign(target,...sources))