JSFiddle - React, Tailwind, and code Playground
by Gleb
JavaScript
var Parent = function (name) {
this.meth1 = function () {
console.log("Parent meth1 ", name);
};
this.meth2 = function() {
console.log('Parent meth2 ', name);
};
return this;
}
var Child = function (name) {
var child = new Parent(name);
for (var property in child) {
this[property] = child[property];
}
this.meth1 = function () {
console.log("Child ", name);
};
return this;
}
childObj = new Child("bla");
childObj.meth1();
childObj.meth2();