this code works in google chrome, but not in firefox.
Code:
function merge(obj1, obj2) {
var a ={};
for (var p in obj1) {
try {
// Property in destination object set; update its value.
if ( obj1[p].constructor==Object ) {
a[p] = merge(a[p], obj1[p]);
} else {
a[p] = obj1[p];
}
} catch(e) {
// Property in destination object not set; create it and set its value.
a[p] = obj1[p];
}
}
for (var p in obj2) {
try {
// Property in destination object set; update its value.
if ( obj2[p].constructor==Object ) {
a[p] = merge(a[p], obj2[p]);
} else {
a[p] = obj2[p];
}
} catch(e) {
// Property in destination object not set; create it and set its value.
a[p] = obj2[p];
}
}
return a;
}
var d=function(){'c';}
var a ={a:{b:'c'},b:'c'}
var b ={c:a,d:d};
var c = merge(window,b);
WHY?!?!?!?!?!?!?!?!?!?!?!?!??!?!?!?!