title: Access static mathod before using »super«
body: <p>there is this class hierarchy:</p>
  
  <pre><code>class A {
    constructor (obj) {
      this.obj = obj
    }
  }
  
  class B extends A {
  
    static createObj () { 
      return {from: 'B'};
    }
  
    constructor () {
      const obj = B.createObj();
      super(obj);
    }
  }
  </code></pre>
  
  <p>I would like to extend this such that:</p>
  
  <pre><code>class C extends B {
    static createObj () {
      return { from: 'C' };
    }
  }
  
  //such that:
  console.log(new C().obj.from) // 'C'
  </code></pre>
  
  <p><strong>BUT</strong> therefore I need to change <code>const obj = B.createObj()</code> to something like:  <code>const obj = Object.getPrototypeOf(this).constructor.createObj();</code>, what is throwing this error:</p>
  
  <pre><code> ReferenceError: Must call super constructor in derived class before accessing 'this' or returning from derived constructor
  </code></pre>
  
  <p>So basically I would like to override a method that creates an object to be used within the <code>super()</code> call. Since <code>this</code> cannot be used before that, I chose to use a static method. Is there any way to reference the static method, without using this and without overriding the constructor as well?</p>