title: constructor function: something related to an instance or something related to a class?
body: <p>What should I put into a constructor function: something related to an instance or something related to a class?</p>
  
  <p>Consider this code:</p>
  
  <pre><code>var count = 0
  TView = function (x, y) { this.x = x, this.y = y, this.id = count++ }
  TGroup = function() {}
  TGroup.prototype = new TView
  var v1 = new TView(1, 1)
  var g1 = new TGroup(2, 2)
  console.log(count, v1.id, g1.id, g1.x, g1.y)
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>2 1 0 undefined undefined
  </code></pre>
  
  <p>here <code>new TView</code> happens twice... Once when I really need to create a <code>TView</code> instance, other time when I assign a <code>TGroup</code> <strong>prototype.</strong> Hence my question. </p>