JSFiddle - React, Tailwind, and code Playground

by JAAulde

JavaScript

var A = function()
{
    this.name = 'A';
};

A.prototype.doSomething = function()
{
    console.log('doSomething in A - this is ' + this.name );
};


var B = function()
{
    this.name = 'B';
};

B.prototype.doSomething = function()
{
      A.prototype.doSomething.apply( this, arguments );

      console.log('doSomething in B - this is ' + this.name );
};


var objA = new A();
objA.doSomething();

var objB = new B();
objB.doSomething();