Skip to content

Instantly share code, notes, and snippets.

@Saneyan
Last active December 20, 2015 07:49
Show Gist options
  • Select an option

  • Save Saneyan/6095699 to your computer and use it in GitHub Desktop.

Select an option

Save Saneyan/6095699 to your computer and use it in GitHub Desktop.
var binder = function () {
function func(next) {
next.apply(this, Array.prototype.slice.call(arguments, 1));
};
func.bind = function (f) {
return Function.prototype.bind.call(this, null, f);
};
return func;
};
var x = binder();
var a = function () {};
var b = x.bind(a);
var c = x.bind(b);
var d = x.bind(c);
var e = x.bind(d);
var f = x.bind(e);
f(); // f() -> e() -> d() -> c() -> b() -> a()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment