JSFiddle - React, Tailwind, and code Playground

by alexflav23

JavaScript

function inherits(child, parent) {
  function tmp() {};
  tmp.prototype = parent.prototype;
  child.prototype = new tmp();
  child.prototype.constructor = child;
}

function A() {
    this.x = 5;
}

A.prototype.print = function(value) {
    document.body.innerHTML += "<p>" + value + "</p>";
};

function B() {
    A.call(this);
}
inherits(B, A);

var x = new B;
x.print("inheritance");