JSFiddle - React, Tailwind, and code Playground
by zebra
JavaScript
function base() {
this.name = 'base';
this.test = function(c) {
c(this.name);
};
}
function bla() {
this.name = 'bla';
this._base = new base();
this.say = function(arg) {
console.log(this.name + '- arguments = ' + arg);
};
this.init = function() {
this._base.test(this.say.bind(this));
};
}
/*
console.log(Function.bind);
if(typeof Function.prototype.bind == 'undefined') {
Function.prototype.bind = function(thisArg) {
var fn = this, slice = Array.prototype.slice, args = slice.call(arguments, 1);
return function() {
return fn.apply(thisArg, args.concat(slice.call(arguments)));
};
};
}*/
var o = new bla();
o.init();