A widely used utility when writing jQuery plugins or modern webapps is the
exdend function. This method allows you to copy the keys of one object into another.
It is also known as
assign, and both jQuery and Underscore provide it out of the box. If you want to write your own implementation, this is a starting point (without deep copy):
An example of use is within a module, where you can define some default values and then override them at runtime, per instance:
If you are looking for more complex
extend functions check out jQuery, Underscore or Lo-Dash source code.