JSFiddle - React, Tailwind, and code Playground
JavaScript
function someObject () {
this.someProperty = 1;
}
someObject.prototype.incrementProperty = function() {
this.someProperty += 1;
return this.someProperty;
}
newObject.prototype = new someObject();
newObject.prototype.parent = someObject.prototype;
newObject.constructor = newObject;
function newObject () {
// we could do useful work here
}
newObject.prototype.incrementProperty = function() {
this.parent.incrementProperty.call(this);
//do everything the super class has for this property already
return this.someProperty;
}
var incrementer = new newObject();
alert (incrementer.incrementProperty()); //I want output to be 2