Why Javascript's extend function has to set Object's prototype's constructor properly?
<p>This is the definition of <code>extend</code> in Pro Javascript Design Patterns, Apress, 2008, p.44:</p>

<pre><code>function extend(subClass, superClass) {
  var F = function() {};
  F.prototype = superClass.prototype;
  subClass.prototype = new F();
  subClass.prototype.constructor = subClass;

  subClass.superclass = superClass.prototype;
  if(superClass.prototype.constructor == Object.prototype.constructor) {
    superClass.prototype.constructor = superClass;
  }
}
</code></pre>

<p>For the line <code>subClass.superclass = superClass.prototype;</code>, I think it probably is equally the same if we do <code>subClass.superclass = superClass</code>, since in the future, we can always get to the prototype by <code>subClass.superclass.prototype</code> anyway.  But I thought why not point to the constructor function, but point to the prototype?  But this is a minor question.</p>

<p>The more important questions is, why do the last lines try to set the Object's prototype's constructor back to self?  I tried it in Firefox and Chrome, and they always point that way already.</p>

<p>Also a little strange is that, why does it use <code>if(superClass.prototype.constructor == Object.prototype.constructor)</code> ?  Why not just use <code>if (superClass === Object)</code> instead?</p>
