JSFiddle - React, Tailwind, and code Playground

by ethagnawl

JavaScript

var Foo = function () {
    this.x = function () {
        console.log('ancestor x');
    }
}

var Bar = function () {
    this.x = function () {
        console.log('inherited x');
        Bar.prototype.x.call(this);
    }
}

Bar.prototype = new Foo;

new Bar().x();