JSFiddle - React, Tailwind, and code Playground
by brigand
JavaScript
const bind = (func, thisArg, ...otherArgs) => {
return function(...moreArgs) { return func.call(thisArg, ...otherArgs, ...moreArgs) };
};
const a = function(bar, baz){
console.log(this.foo, bar, baz);
};
const b = bind(a, {foo: 1}, 'bar');
const c = bind(b, {foo: 2}, 'baz');
console.log(c());