title: Extending the defaults of a Model superclass in Backbone.js
body: <p>I would like to pose this as a question to <a href="https://stackoverflow.com/questions/6505873/in-backbone-js-how-can-i-get-model-superclass-defaults-to-act-as-defaults-for-sub/6508530#6508530">this</a> answer but I can't seem to do so, I apologize.</p>
  
  <p>Extending the defaults for the subclass are reflected in the superclass.  This seems to defeat the purpose and I'm more apt to explicitly list the superclass' defaults in the subclass to get the structure I'm looking for.</p>
  
  <pre><code>var Inventory = Backbone.Model.extend({
      defaults: {
          cat: 3,
          dog: 5
      }
  });
  
  var ExtendedInventory = Inventory.extend({
  });
  
  _.extend(ExtendedInventory.prototype.defaults, {rabbit: 25});
  
  var i = new Inventory();
  var ei = new ExtendedInventory();
  console.log(i.attributes);
  console.log(ei.attributes);
  </code></pre>
  
  <p>This outputs:</p>
  
  <pre><code>{cat: 3, dog: 5, rabbit: 25}
  {cat: 3, dog: 5, rabbit: 25}
  </code></pre>
  
  <p>Not what I (nor, I assume, the <a href="https://stackoverflow.com/questions/6505873/in-backbone-js-how-can-i-get-model-superclass-defaults-to-act-as-defaults-for-sub">op</a>) want:</p>
  
  <pre><code>{cat: 3, dog: 5}
  {cat: 3, dog: 5, rabbit: 25}
  </code></pre>