function copyObj(oldObj){ var newObj = Array.isArray(oldObj) ? [] :{}; for(var p in oldObj){ if(typeof oldObj[p]== 'object'){ newObj[p] ==copyObj(oldObj[p]) }else{ newObj[p] = oldObj[p]; } } return newObj; }
function copyObj(oldObj){ var newObj = Array.isArray(oldObj) ? [] :{}; for(var p in oldObj){ if(typeof oldObj[p]== 'object'){ newObj[p] ==copyObj(oldObj[p]) }else{ newObj[p] = oldObj[p]; } } return newObj; }