Skip to content

Instantly share code, notes, and snippets.

@sbstp
Last active August 29, 2015 13:57
Show Gist options
  • Save sbstp/9791798 to your computer and use it in GitHub Desktop.
Save sbstp/9791798 to your computer and use it in GitHub Desktop.
function bind(fn, context) {
return function () {
return fn.apply(context, arguments);
}
}
function hey() {
console.log(this, arguments);
return 'moist';
}
var w1 = hey.bind('oy');
var w2 = bind(hey, 'oy');
console.log(w1(1,2,3));
console.log(w2(1,2,3));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment