title: How can I merge 2 javascript objects, populating the properties in one if they don't exist in the other?
body: <p>If I have a javascript object/assoc. array defined like this:</p>
  
  <pre><code>function somefunction(options) {
  
      var defaults = {
          prop1: 'foo',
          prop2: 'bar'
      };
  
      //Do stuff here
  
  }
  </code></pre>
  
  <p>and I want to use this as the default values for the function.  So when the function gets called I want to populate the <code>options</code> variable with the values in <code>defaults</code>, but only if they don't exist in <code>options</code>.</p>
  
  <p>So lets say that this was called</p>
  
  <pre><code>somefunction({ prop1: 'fish' });
  </code></pre>
  
  <p>How can I make it so that <code>options</code> gets merged with <code>defaults</code> such that I get this</p>
  
  <pre><code>{
      prop1: 'fish',
      prop2: 'bar'
  }
  </code></pre>