JSFiddle - React, Tailwind, and code Playground

JavaScript

var Dog = (function () {
    function Dog() {
        if (this instanceof Dog) {
            // constructor code
        } else return Object.create(private);
    }

    var public = Dog.prototype, private = Object.create(public, {
        size: {
            value: "big"
        }
    });

    public.saySize = weakBind(function (private) {
        return "I am a " + private.size + " dog.";
    }, public, private);

    return Dog;
}());

var Chihuahua = (function () {
    function Chihuahua() {
        Dog.call(this);
    }

    var private = Dog();

    Object.defineProperty(private, "size", {
        value: "small"
    });

    var public = Chihuahua.prototype = Object.create(Dog.prototype);

    public.saySize = weakBind(public.saySize, public, private);

    return Chihuahua;
}());

var dog = new Dog;
alert(dog.saySize());
alert(dog.size);

var chi = new Chihuahua;
alert(chi.saySize());
alert(chi.size);

function weakBind(functable, prototype, state) {
    return function () {
        return functable.apply(this, Object.getPrototypeOf(this) === prototype ?
            [state].concat(Array.prototype.slice.call(arguments)) : arguments);
    };
}