title: Object.create changes prototype.constructor to parent constructor, but upon child instantiation, child constructor runs
body: <p>I've created an example to illustrate:</p>
  
  <pre><code>// this is the parent class
  function animal() { console.log('animal constructor') }
  
  // allow animals to walk
  animal.prototype.walk = function() { console.log('animal walking') }
  
  // create child class
  function cat() { console.log('cat constructor') }
  
  // cat inherits from animal
  cat.prototype = Object.create(animal.prototype);
  
  // let cats meow
  cat.prototype.meow = function() { console.log('meow') }
  
  // create a cat object
  var myCat = new cat();
  
  /* output: cat constructor */
  
  // yet, the constructor that ran is different than what the prototype for cat reports
  console.log(cat.prototype.constructor);
  
  /* output: function animal() { console.log('animal constructor') } */
  </code></pre>
  
  <p>So note how inheritance mostly worked as expected, cat inherited the method 'walk' from its parent dog class, and adding further methods to the child class such as meow works as expected. However, when I create an instance of cat, the constructor for cat runs, whereas cat.prototype.constructor points to the constructor "inherited" from dog. </p>
  
  <p>Isn't the purpose of object.prototype.constructor to allow us to modify the constructor of an object after the object has been declared without wiping out the prototype for the object? In the above example, shouldn't the constructor stored in cat.prototype.constructor point to the same constructor that runs when creating a cat object? Does this apparent ambiguity have something to do with how in <a href="http://ejohn.org/blog/simple-javascript-inheritance/" rel="nofollow">this source code</a>  this statement is run:</p>
  
  <pre><code>// Enforce the constructor to be what we expect
  Class.prototype.constructor = Class;
  </code></pre>