JSFiddle - React, Tailwind, and code Playground

by dima_k

JavaScript

function SuperType(){
    this.property = 'Super value';
}
SuperType.prototype.getSuperValue = function(){
    return this.property;
};
function SubType(){
    this.subproperty = 'Sub value';
}
//inherit from SuperType
SubType.prototype = new SuperType();
SubType.prototype.getSubValue = function (){
    return this.subproperty;
};
var instance = new SubType();
console.log(instance.getSubValue());
console.log(instance.getSuperValue()); 

console.log(instance instanceof SuperType);
console.log(instance instanceof SubType);