JSFiddle - React, Tailwind, and code Playground

by chrisramakers

JavaScript

function ClassA(value, name){
    this.name = name;
    this.type = 'a class';
    this.value = value;
    this.getValue = function(){
        return this.value;
    }
    this.getName = function(){
        return this.name;
    }
}

function ClassB(value, name){
    ClassA.apply(this, [value, name]);
    //ClassA.apply(this, arguments);
}

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

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

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