title: Javascript: Get subclass type in superclass
body: <p>I am using <a href="http://ejohn.org/blog/simple-javascript-inheritance/" rel="nofollow noreferrer">this</a> to create a few classes and to set up some inheritance structure. </p>
  
  <pre><code>var ControlType = Class.extend({
      init: function(){ },
  
      html: function(type){
          //Get template based on name of subclass
      }
  });
  
  var YesNo = ControlType.extend({
      init: function(){ },
      html: function() {
          this._super('YesNo')
      }
  });
  </code></pre>
  
  <p>Now I was wonder if it's possible to get the type of the subclass in <code>ControlType.html</code> without passing it explicitly?</p>
  
  <h2>Update:</h2>
  
  <p>I tried <code>this.constructor</code> without the extend functionality as someone suggested but this returns the type of the parent class. So in the following example the console logs Person() but I need Jimi().</p>
  
  <pre><code>function Person(){
      this.say = function(){
          console.log(this.constructor);
      }
  }
  
  function Jimi(){
      this.name = 'Jimi';
  }
  Jimi.prototype = new Person();
  
  var j = new Jimi();
  j.say();
  </code></pre>