let obj1={
name:'鲁班',
age:1,
like:['抽烟','喝酒','烫头'],
schoole:{
sname:'王者荣耀',
address:'TIMI训练营'
}
}
let obj2={}
function deepClone(obj,target){
for(let key in obj){
let item=obj[key]
if(item instanceof Object){
target[key]={}
deepClone(item,target[key])
}else if(item instanceof Array){
target[key]=[]
deepClone(item,target[key])
}else{
target[key]=obj[key]
}
}
}
deepClone(obj1,obj2)
console.log(obj2);