JSFiddle - React, Tailwind, and code Playground
JavaScript
function Test() { }
Test.prototype = {
method: function() {
document.write(this.toString() + '<br>');
}
}
var obj = new Test();
// bind it to some object
var f = obj.method.bind(42);
f();
// bind it to something else
var g = obj.method.bind('Hi');
g();
// how about a re-bind?
var f2 = f.bind('Hi');
f2();