JSFiddle - React, Tailwind, and code Playground

by alexflav23

JavaScript

var A = function() {
};

A.prototype.method = function() {
    console.log("something");
};

var B = function() {
};

B.prototype.doSomethingElse = function() {
    console.log("something else");
};

var b = new B();

function extend() {
    var args = Array.prototype.slice.call(arguments),
        final = function() {}, intermediary = function() {},
        protos = [];
        protos[0] = function() {};
        protos[0].prototype = Object.create(args[0].prototype);
    for (var i = 1, len = args.length; i < len; i++) {
        args[i].protoype = Object.create(protos[i - 1].prototype);
        protos[i] = args[i];
    };
    return protos[protos.length - 1];  
};

var C = extend(A, B);
var c = new C();
//c.method();
c.doSomethingElse();