I'm using protypal inheritance and I would like to call an overridden method on the base class. In PHP I could do this using parent::functionName. Is this possible using JavaScript protypal inheritance?
Consider the following example:
var A = function(){
this.doSomething = function(){
console.log('doSomething in A');
};
};
var B = function() {
this.doSomething = function(){
//I would like to call A.doSomething()
//I tried this.prototype.doSomething() and A.doSomething.call(this), but neither works
console.log('doSomething in B');
};
};
B.prototype = new A();
var test = new B();
test.doSomething();
The output that I'm looking for in the console is:
doSomething in B
doSomething in A