I have the following code:
this.myObject = {
   key1: "val1",
   key2: "val2"
}
this.aMethod = function (newObject) {
    ...
Here I want a new object (probably that inherits from this.myObject) that contains everything in this.myObject plus whatever is in newObject also, fields in newObject should override already existing fields in this.myObject
How do I do this?
This idea is that this.myObject provides some default values - but the user of the method can override these values.  I'm open to criticisms of this overall "pattern" as well.  Thanks.
 
     
     
     
     
    