I have a function that takes a config object as an argument. Within the function, I also have default object. Each of those
config
default
The approach of Ivan Kuckir's can also be adapted to create a new object prototype:
Object.prototype.extend = function(b){ for(var key in b) if(b.hasOwnProperty(key)) this[key] = b[key]; return this; } var settings = default.extend(config);