title: What happens when you change an object's prototype?
body: <p>What happens when we do:</p>
  
  <pre><code>Cat.prototype = new Mammal();
  </code></pre>
  
  <p>My guess is that, besides changing <code>__proto__</code>, nothing really happens, and <code>Cat.prototype</code> is not changed. Or if it is, then properties are copied to it, and it's not replaced by the new object we just created.</p>
  
  <p>Any ideas?</p>
  
  <p>this is it:
  the mistake was using myCat.prototype which is undefined...
  when you check Cat.prototype you can see that it is replaced too</p>
  
  <pre><code>var myCat = new Cat();    
  alert(myCat.__proto__ instanceof Mammal); // true
  alert(myCat.__proto__ instanceof Cat);    // false
  
  alert(Cat.prototype instanceof Mammal); // true 
  alert(Cat.prototype instanceof Cat);    // false
  </code></pre>
  
  <p>we don't want to call new here, you are right, cause that will cause object members of Mammal instance to be prototype members of Cat. (the constructor of Mammal is called and create its members as the prototype members where they are shared by all Cat objects)</p>