JSFiddle - React, Tailwind, and code Playground
by gschutz
JavaScript
Function.prototype.method = function(name, fn) {
this.prototype[name] = fn;
return this;
};
Function.method('inherits', function (Parent) {
this.prototype = new Parent();
return this;
});
var A = function() {
var A = function() {
this.foo = function(){
return this;
}
}
return new A();
}
var B = function() {
var B = function() {
this.bar = function(){
return this;
}
}
return new B();
}
A.inherits(B);
var a = A(), b = B();
console.log(a,b);