JSFiddle - React, Tailwind, and code Playground
JavaScript
var Parent = function(options) {
// constructor
this.val_one = options.one;
console.log("parent");
};
Parent.prototype.other_method = function() {
console.log("Parent: other_method")
}
var Child = function(options) {
Parent.call(this, options);
this.val_two = options.two
console.log("child");
};
Child.prototype = Object.create(Parent.prototype); // See note below
Child.prototype.constructor = Child;
Child.prototype.other_method = function() {
console.log("Child: other_method")
};
var options = {};
options.one = "hello";
options.two = "there";
var parent_instance = new Parent(options)
var child_instance = new Child(options)
parent_instance.other_method()
child_instance.other_method()