title: javascript how to get subclass '__dirname' from super class
body: <p>I want to create a method in a parent class that will return the location of each subclass that extends it.</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 dir is '/classes/a/
  class A{      
      getPath(){
          console.log(__dirname);
          return (__dirname);
      }
  }
  
  // Class B dir is '/classes/b'
  class B extends A{ 
  
  }
  
  new A().getPath(); // Prints '/classes/a'
  new B().getPath(); // Prints '/classes/a' (I want here '/classes/b');</code></pre>
  </div>
  </div>
  </p>
  
  <p>I understand why class B prints the location of A, but I'm looking for an option of making a method on the parent class that will print the subclass's location. I don't want to override the method in every subclass because it missing the point</p>
  
  <p>I tried <code>process.pwd()</code> as well.</p>