I've run into this behavior after using JS for a few months. I'm very puzzled because of my Java background: I create a class and make subclasses. Call a subclass' constructor won't call the parent constructor. Ok, I read about this behavior, it seems normal, right?
See this jsfiddle example to help me clarify.
So to have my subclass constructor run each of its parent constructor, I'm adding the following (see jsfiddle example
Ok, seems to work better this way. Now, I'm wondering about the following; Is there a way to specify wich is the superclass without trigger its constructor? Like for instance the following runs the Node() method:
GameObject.prototype = new Node();
GameObject.prototype.constructor=GameObject;
(see updated jsfiddle example)
I can't help but feel I'm not doing it right. As my real model is layered across 7 subclasses, there's a total of 21 calls to my constructors (6 + 5 + 4 + 3 + 2 + 1 = 21).
Am I doing something wrong? Thanks for your time!