title: JavaScript inheritance and the constructor property
body: <p>Consider the following code.</p>
  
  <pre><code>function a() {}
  function b() {}
  function c() {}
  
  b.prototype = new a();
  c.prototype = new b();
  
  console.log((new a()).constructor); //a()
  console.log((new b()).constructor); //a()
  console.log((new c()).constructor); //a()
  </code></pre>
  
  <ul>
  <li>Why isn't the constructor updated for b and c?</li>
  <li>Am I doing inheritance wrong?</li>
  <li>What is the best way to update the constructor?</li>
  </ul>
  
  <p>Further, please consider the following.</p>
  
  <pre><code>console.log(new a() instanceof a); //true
  console.log(new b() instanceof b); //true
  console.log(new c() instanceof c); //true
  </code></pre>
  
  <ul>
  <li>Given that <code>(new c()).constructor</code> is equal to <code>a()</code> and <code>Object.getPrototypeOf(new c())</code> is <code>a{ }</code>, how is it possible for <code>instanceof</code> to know that <code>new c()</code> is an instance of <code>c</code>?</li>
  </ul>
  
  <blockquote>
    <p><a href="http://jsfiddle.net/ezZr5/">http://jsfiddle.net/ezZr5/</a></p>
  </blockquote>