JSFiddle - React, Tailwind, and code Playground
JavaScript
//our base class
function baseClass()
{
this.att1 = "att1";
}
//that is class extending base class
function childClass1()
{
this.c1_att1 = "c1_att1";
}
childClass1.prototype = new baseClass();
//and another one extending
function childClass2()
{
this.c2_att1 = "c2_att1";
}
childClass2.prototype = new baseClass();
//create instances of each child class first
var test1 = new childClass1();
var test2 = new childClass2();
//add another attribute to the base class using prototype
baseClass.prototype.GUID = undefined;
baseClass.prototype.setGUID = function(id){ this.GUID = id;}
//now both child classes see the property with the value we added
alert( "test1.GUID : " + test1.GUID + "\ntest2.GUID : " + test2.GUID );
//we change the property accessing it from one of child classes
test2.setGUID(66);
//now both child classes have different value of the property
alert( "test1.GUID : " + test1.GUID +"\ntest2.GUID : " + test2.GUID );