SOURCE

const deepClone = obj =>{
    if(obj === null) return null
    let clone = Object.assign({},obj)
    Object.keys(clone).forEach(key=>
            (clone[key] = typeof obj[key] === 'object'?deepClone(obj[key]):obj[key]
     ))
    if(Array.isArray(obj)){
         clone.length = obj.length
         return Array.from(blone)
     }
     return clone
}
let obj = {foot:'bar',fn:function(){}}
console.log('obj111',obj.fn)
console.log(deepClone(obj))
console 命令行工具 X clear

                    
>
console