rafaello
rafaello

Reputation: 193

Is it possible to use a method from the parent class in the overwritten version in its child in javascript?

Is it possible to use a method from the parent class in the overwritten version in its child in javascript?

Upvotes: 4

Views: 51

Answers (3)

ase
ase

Reputation: 13471

If you are using the module pattern check out this article: http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth

Upvotes: 0

xil3
xil3

Reputation: 16439

You could call the following in the overwritten version in the child class:

ParentClass.prototype.methodYouAreOverwriting.call(this);

Upvotes: 0

SLaks
SLaks

Reputation: 887365

Yes:

ParentClass.prototype.methodName.call(this, arg1, arg2);

Upvotes: 3

Related Questions