JSFiddle - React, Tailwind, and code Playground

JavaScript

function autoParent(parentProto, childrenProto) {
    var parentFn, childrenFn, k;

    for (k in childrenProto) {
        if (childrenProto.hasOwnProperty(k)) {
              parentFn = parentProto[k];
              childrenFn = childrenProto[k];
              childrenProto[k] = function () {
                  var self = this;
                  this.parent = function () {
                      parentFn.apply(self, arguments);
                  };
                  childrenFn.apply(self, arguments);
              };
        }
    }
}

function Person(name) {
    this.name = name;
}

Person.prototype.sayHi = function () {
    alert('Hi my name is ' + this.name);
};

function Employee(name) {
    Person.call(this, name);
}

Employee.prototype = Object.create(Person.prototype);

Employee.prototype.sayHi = function () {
    this.parent();
    alert('and I am an Employee!');
};

autoParent(Person.prototype, Employee.prototype);

var e = new Employee('Foo Bar');

e.sayHi();