JSFiddle - React, Tailwind, and code Playground
JavaScript
var cApply = function(c) {
var ctor = function(args) {
c.apply(this, args);
};
ctor.prototype = c.prototype;
return ctor;
};
function Constructor(arg1, arg2) {
this.foo = arg2;
this.init();
};
Constructor.prototype.bar = 'baz';
Constructor.prototype.init = function() {
alert(this.foo);
alert(this.bar);
}
var Wrapped = cApply(Constructor);
var o = new Wrapped([1, 5]);