JSFiddle - React, Tailwind, and code Playground
JavaScript
function extend(subClass, superClass) {
var F = function() {};
F.prototype = superClass.prototype;
subClass.prototype = new F();
subClass.prototype.constructor = subClass;
subClass.superclass = superClass.prototype;
if(superClass.prototype.constructor == Object.prototype.constructor) {
superClass.prototype.constructor = superClass;
}
}
function AnotherMan(name) {
this.name = name;
}
function Mr(name) {
Mr.superclass.constructor.call(this, name);
this.name = "Mr. " + name;
}
extend(Mr, AnotherMan);
var mrBean = new Mr("Bean");
alert(mrBean.name + ', instance of AnotherMan: ' + (mrBean instanceof AnotherMan));