SOURCE

// var arr = [{name:1},{name:2}]

// // var _arr = arr.slice();
// var __arr = [...arr]
// var _arr = JSON.parse(JSON.stringify(arr))

// setTimeout(() => {
//     arr[0].name = 2;
//     console.log(arr, _arr, __arr, arr[0] === __arr[0])
// }, 1000)

var obj = {name:1, father: {name:'Tom'}};
// var _obj = Object.assign({}, obj);
// var _obj = {...obj}
var _obj = JSON.parse(JSON.stringify(obj));

setTimeout(() => {
    // obj.name = 2;
    obj.father.name = 'Jerry'
    console.log(obj, _obj, obj.father === _obj.father)
}, 1000)
console 命令行工具 X clear

                    
>
console