const obj = {name:'changjk',family:{father:'zs',mother:'shh'},hobby:['打游戏','喝茶','打羽毛球']}
//深拷贝
const cloneObj=(obj)=>{
const newObj={}
for(const key in obj){
if(Object.prototype.toString.call(obj[key]) === '[Object,Array]'){
cloneObj(obj[key])
}else if(Object.prototype.toString.call(obj[key]) === '[Object Object]'){
cloneObj(obj[key])
}else {
newObj[key] = obj[key]
}
}
return newObj
}
console.log(cloneObj(obj))