JSFiddle - React, Tailwind, and code Playground
JavaScript
var App = (function(){
var Being = function() {
this.living = true;
this.breathes = function () {
return true;
};
};
var Robert = function() {
this.blogs = true;
this.getsBored = function () {
return "You betcha";
}
};
Robert.prototype = new Being();
return {
Being: Being,
Robert: Robert,
being: function(){ return new Being(); },
robert: function(){ return new Robert(); }
}
}());
App.Robert.prototype.newMethod = function() {
console.log('new method executed');
return this;
};
var r1 = App.robert();
var r2 = new App.Robert;
var r3 = App.being();
var r4 = new App.Being;
console.log(r1.__proto__ == r2.__proto__);
console.log(r1.__proto__);
console.log(r2.__proto__);
console.log(r3.__proto__);
console.log(r4.__proto__);
console.log(r4);
r1.newMethod();