function deepCopy(p,c){
c=c || {};
for(var i in p){
if(p.hasOwnProperty(p[i])){
if(typeof(p[i])==='object'){
c[i] = Array.isArray(p[i])?[]:{};
deepCopy(p[i],c[i])
}else{
c[i]=p[i]
}
}
}
return c;
}
function deepCopy(p,c){
c=c || {};
for(var i in p){
if(p.hasOwnProperty(p[i])){
if(typeof(p[i])==='object'){
c[i] = Array.isArray(p[i])?[]:{};
deepCopy(p[i],c[i])
}else{
c[i]=p[i]
}
}
}
return c;
}
转载于:https://www.cnblogs.com/jessicaWy/p/7255914.html