<script>
var a={
b : 1,
c : "abc",
e:[1,2,3]
},
clone=function(obj){
var c, i;
if(obj.constructor==Array){
c=[];
for(i=0;i<obj.length;i++){
c[i]=obj[i];
}
return c;
}
if(obj.constructor==Object){
c=[];
for(i in obj){
c[i]=obj[i];
}
return c;
}
return alter("is not obj");
},
c={};
for(i in a){
if(a[i].constructor==Array || a[i].constructor==Object){
c[i]=clone(a[i]);
}
else{
c[i]=a[i];
}
}
console.log(a);
console.log(c);
</script>