JSFiddle - React, Tailwind, and code Playground
JavaScript
var Base = defclass(Object, function () {
this.constructor = function () {
var priv = "private";
this.publ = "public";
};
});
var MyClass = defclass(Base, function (uber) {
this.constructor = function () {
uber.constructor.call(this);
alert(this.publ);
};
});
var a = new MyClass; // alerts "public"
function defclass(base, body) {
var uber = base.prototype;
var prototype = Object.create(uber);
var constructor = (body.call(prototype, uber), prototype.constructor);
constructor.prototype = prototype;
return constructor;
}