JSFiddle - React, Tailwind, and code Playground
by alexflav23
JavaScript
function inherits(childCtor, parentCtor) {
/** @constructor */
function tempCtor() {};
tempCtor.prototype = parentCtor.prototype;
childCtor.superClass_ = parentCtor.prototype;
childCtor.prototype = new tempCtor();
/** @override */
childCtor.prototype.constructor = childCtor;
};
Object.create = function (o, props) {
var s = function() {
Function.prototype.call(this);
s.prototype = o.prototype;
};
inherits(s, o);
function F() {}
F.prototype = s;
for (var key in props) {
if (props.hasOwnProperty(key)) {
if (typeof F[key] === 'undefined') {
F.prototype.prototype[key] = function(){};
F.prototype.prototype[key] = props[key];
};
};
};
return new F.prototype();
};
var test = function() {};
test.prototype.do = function() {console.log("im still here")};
var props = {"hmm": "is it here?"};
var c = Object.create(test, props);
console.dir(c);
c.do();