var a={
c:{
b:"1"
},
a:1
}
var b={
c:{
b:2,
a:1
},
a:3,
c:{
e:1
}
}
function marge(a,b){
function getType(name,obj){
return Object.prototype.toString.call(obj)=="[object "+name+"]"
}
if(getType("Object",a)&&getType("Object",b)){
for(let i in b){
if(getType("Object",a[i])&&getType("Object",b[i])){
marge(a[i],b[i]);
}else{
a[i]=b[i]
}
}
}
return a;
}