SOURCE

const obj = {
    id: 1,
    name: 'Tom',
    age: 23,
    sex: 1,
    parentId: [1],
    like: undefined,
    friends: [2, 3, null, undefined]

}

// Object.create
console.log('Object.create')
const obj1 = Object.assign(Object.create(null), obj)
obj1.name = 'Win'
obj1.friends = [] // 重新赋值了一个指针

console.log(obj1.name)
console.log(obj.name)
console.log(obj1.friends)
console.log(obj.friends)

// ... 解构运算符
console.log('... 解构运算符')
const obj2 = {...obj}
obj2.name = 'Low'
obj2.parentId.push(2)

console.log(obj2.name)
console.log(obj.name)
console.log(obj2.parentId)
console.log(obj.parentId)
console 命令行工具 X clear

                    
>
console