Skip to content

Instantly share code, notes, and snippets.



Created Aug 1, 2013
What would you like to do?
The Apply Invocation Pattern
myFn = function(msg){
return msg + this.status;
o = { status: "killing it" }
myFn.apply(o, ["Your status is: "])
//>> "Your status is: killing it"
//call apply on a function, first arg is the value of "this" inside the fn,
//2nd arg is an array of parameters for the function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment