JSFiddle - React, Tailwind, and code Playground
JavaScript
function Base() {
this.close = function() { alert('base close'); }
}
function Child() {
var self = this;
Base.call(this);
this.close = (function() {
var baseClose = self.close;
return function() {
baseClose.call(self);
alert('child close');
};
})();
}
var base = new Base(),
child = new Child();
base.close();
child.close();