Skip to content

Instantly share code, notes, and snippets.

@kgarfinkel
Created October 20, 2013 02:16
Show Gist options
  • Save kgarfinkel/7064078 to your computer and use it in GitHub Desktop.
Save kgarfinkel/7064078 to your computer and use it in GitHub Desktop.
Javascript's 'apply' re-implemented.
var apply = function(fn, context) {
var args = Array.prototype.slice.call(arguments, 2),
result;
context.fn = fn;
result = context.fn(args);
delete this.fn;
return result;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment