title: subclass.prototype = new superclass() vs. subclass = new superclass()
body: <p>I've been instantiating subclasses in javascript using</p>
  
  <pre><code>object = new class ()
  </code></pre>
  
  <p>but I notice some people instantiate using</p>
  
  <pre><code>object.prototype = new class ()
  </code></pre>
  
  <p>Question: What's the difference? To me it seems like the latter is respecting the inheritance chain more because if <code>class ()</code> has a bunch of "<code>this.variable = x</code>" statements, and object is something you want to inherit from it rather than an instance of class, you are accurately assigning those variables to object's prototype rather than to the object itself as in the former case. So in effect it's like this? </p>
  
  <pre><code>object = new class () |vs.| subclass.prototype = new superclass ()
  </code></pre>
  
  <p><strong>However, functionally in the program both are the same?</strong></p>
  
  <p>Side question: Also I'm a bit unclear as to what the <code>new</code> operator actually does. It seems to me to do something like just create an empty object and assign it's <em>proto</em> property?</p>