JSFiddle - React, Tailwind, and code Playground

by chrisramakers

JavaScript

var ClassA = function(name, type){
    this.name = name;
    this.type = type;
}
ClassA.prototype.getName = function(){
    return this.name;
}
    
var ClassB = function(name, type){
    ClassA.apply(this, arguments);
}
ClassB.prototype = new ClassA();

var a = new ClassA('ClassA', 'class');
var b = new ClassB('ClassB', 'class');

//document.write(a.getName(), '<hr>');
//document.write(b.getName(), '<hr>');

//document.write(a instanceof ClassA, '<hr>');
//document.write(b instanceof ClassA, '<hr>');
//document.write(b instanceof ClassB);