title: javascript es6 class prototype chain modify
body: <p>I am trying to add class C to the prototype chain of class B</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>class A {
    constructor() {
      this.a = 'a';
    }
  }
  
  class B extends A {
    constructor() {
      super();
      this.b = 'b';
    }
  }
  
  class C extends A {
    constructor() {
      super();
      this.c = 'c';
    }
  }
  
  Object.setPrototypeOf(B.prototype, C.prototype);
  
  var a = new A();
  var b = new B();
  
  console.log(b instanceof C);
  console.log(b instanceof A);
  console.log(b.c);</code></pre>
  </div>
  </div>
  </p>
  
  <p>The problem with the code is that <code>super()</code> call in the constructor of class B does not call the constructor of class C so the property c doesn't get added to the object. What am i doing wrong here?</p>