深層複製(deep clone)需要使用其他的替代方案,因為 Object.assign() 僅複製屬性值。 ... var copy = Object.assign({}, obj); console.log(copy); // { baz: 3 }
確定! 回上一頁