var a = {a: 1};
var b = {b: 2};
var c = Object.assign(a, b);/* a对象也会改变,b不变,返回被被修改对象 */
var d = Object.assign({}, a, b); /* a,b不会被改变,返回新的对象 */
console.log("a", a);
console.log("b", b);
console.log("c", c);
console.log("d", d);
var a = {a: 1};
var b = {b: 2};
var c = Object.assign(a, b);/* a对象也会改变,b不变,返回被被修改对象 */
var d = Object.assign({}, a, b); /* a,b不会被改变,返回新的对象 */
console.log("a", a);
console.log("b", b);
console.log("c", c);
console.log("d", d);