It's not that Javascript doesn't support all OO features. Every concept from classical OO feature can be implemented in Javascript, the questions is if it's really necessary to transpose all these concepts to it. Keep in mind Javascript is a prototype language, most of the times it's much easier to use this for your own good instead of try to achieve all features from other static type languages (though it's not considered evil).
About the topics you mentioned:
Call parent constructor in child constructor:
Since Javascript is a prototype language there is no parent classes, just parent objects. If somehow you need to call a parent constructor from a descendant object your design might be wrong. Parent objects might already exist when you produce a derivate (descendant) object from it, so there is no need to call a constructor again, it sounds pretty strange even in theory.
Refer to the instance of parent object:
AFAIK it's not possible unless you create a reference property on your child object.
Static/Shared methods:
There is no formal implementation for this in Javascript. Every method can be accessed like a static method. See example:
Person.sayHello = function(){
alert("Hello!");
}
Person.sayHello();
new Person.sayHello();
Protected/private fields
There is a shiny addition to ECMAScript 5.1 (see my second link for legacy private member support.). Now you have defineProperty method, the code explains itself:
var cat = {};
Object.defineProperty(cat, "name", {
value: "Maru",
writable: false,
enumerable: true,
configurable: false
});
Object.defineProperty(cat, "skill", {
value: "exploring boxes",
writable: true,
enumerable: true,
configurable: true
});
And here some links that helped me a lot and some that I've read recently:
- About Classical inheritance in Javascript
- Private members in Javascript
- Javascript Additions in ECMAScript 5.1