JSFiddle - React, Tailwind, and code Playground
by amatiasq
HTML
<script src="http://amatiasq.com/fiddle-console.js"></script>
JavaScript
function extend(proto) {
function intermediario() { }
intermediario.prototype = proto;
return new intermediario;
}
var base = {
name: "Alice",
lastname: "Smith",
fullname: function() {
return this.name + ' ' + this.lastname;
}
};
var instancia1 = extend(base);
var instancia2 = extend(base);
instancia1.name = "Bob";
var subInstancia = extend(instancia1);
console.log(subInstancia.fullname());