const obj ={
name:'xin',
hobby:['playGames','footBall','swim','travel'],
outer:{
age:18,
arr:[],
inner:{
hello:'world'}}}functiondeepClone(obj){let result, b, toStr ={}.toString, prop;if((b =(toStr.call(obj)==='[object Array]'))|| toStr.call(obj)==='[object Object]'){
result = b ?[]:{};for(prop in obj){if(toStr.call(obj[prop])==='[object Array]'|| toStr.call(obj[prop])==='[object Object]'){
result[prop]=deepClone(obj[prop]);}else{
result[prop]= obj[prop];}}}else{returnnewTypeError(`'${obj}' is not a Object or Array!`);}return result;}const res =deepClone(obj);