Open lynxerzhang opened 5 years ago
Object.assign的复制对象方法需要注意,该复制行为为浅复制
var d = {"a":1, "b":2, "c":[1, 2, 3]}; var e = Object.assign({}, d); d.c.push(4); console.log(d.c); //1,2,3,4 console.log(e.c); //1,2,3,4
Object.assign的复制对象方法需要注意,该复制行为为浅复制