JSFiddle - React, Tailwind, and code Playground
by joplomacedo
HTML
<button>Click me!</button>
JavaScript
function cat(name) {
this.name = name;
this.talk = function() {
alert( this.name + " say meeow!" )
}
}
var cat1 = new cat("felix");
Object.prototype.method = function (name, func) {
this.prototype[name] = func;
};
cat.method('meth_3', function ( ) {
alert( this.name + " say what!!?");
});
$('button')[0].onclick = function () {
cat1.meth_3();
};