function SuperType() {
this.property = true;
}
SuperType.prototype.getSuperValue = function () {
return this.property;
};
function SubType() {
this.subproperty = false;
}
SubType.prototype = new SuperType();
SubType.prototype.getSubValue = function () {
return this.subproperty;
};
function SuperType() {
this.arr = ['a', 'b']
}
function SubType() {
SubType.call(this);
}
function object(o) {
function F() {
}
F.prototype = o;
return o;
}
function createObject(originalProto) {
const clone = JSON.parse(JSON.stringify(originalProto));
clone.foo = function () {
};
return clone;
}
function inheritPrototype(subType, superType) {
const protoType = JSON.parse(JSON.stringify(subType.prototype));
protoType.constructor = subType;
subType.prototype = protoType;
}
function SuperType() {
this.property = true;
this.arr = ['a', 'b'];
}
SubType.prototype.foo = function () {
};
function SubType() {
SubType.call(this);
this.subproperty = 'foo';
}
inheritPrototype(SubType, SuperType);
SubType.prototype.bar = function () {
};