title: keeping the constructor correctly after inheritance
body: <p>I've noticed this interesting problem:</p>
  
  <pre><code>function a() { this.aprop = 1; }
  function b() { this.bprop = 2; }
  b.prototype = new a(); // b inherits from a
  var x = new b(); // create new object with the b constructor
  assert(x.constructor == b); // false
  assert(x.constructor == a); // true
  </code></pre>
  
  <p>As far as I know, <code>x.constructor</code> should be <code>b</code>, but it's actually <code>a</code> when <code>b</code> inherits from <code>a</code> through its prototype? Is there a way I can inherit from <code>a</code> without screwing up my constructor?</p>