function deepCopy(r,s={}){
for(let p in r){
if(typeof r[p] === 'object'){
if(r[p] instanceof Array){
s[p] = deepCopy(r[p],[])
}else{
s[p] = deepCopy(r[p],{})
}
}else{
s[p] = r[p]
}
}
return s
}
网友评论