var obj ={
a:1,
b:{
C:2
},
d: [3,4,5]
};
function Clone(obj){
if(!obj || (typeof obj !== 'object')){
return;
}
var newObj = Object.prototype.toString.call(obj) == '[object Array]'?[]:{};
for(let key in obj){
if(typeof obj[key] == 'object'){
newObj[key] = Clone(obj[key])
}else{
newObj[key] = obj[key];
}
}
return newObj;
}
console.log(Clone(obj)==obj)
console.log(Clone(obj))