Skip to content

Instantly share code, notes, and snippets.

@JackTanRoo
Created May 21, 2014 08:23
Show Gist options
  • Save JackTanRoo/8e0ad5a96dd97bf425db to your computer and use it in GitHub Desktop.
Save JackTanRoo/8e0ad5a96dd97bf425db to your computer and use it in GitHub Desktop.
function x(arg1){
function y(arg2){
do stuff
}
}(z) // <------where does z get subbed in?
@JackTanRoo
Copy link
Author

so above is essentially like calling:

return x(z); right?

so if I wanted an anonymous function that I dont want to be called elsewhere (like a block in ruby):

i can do this:

function(){
do stuff
}(z)

which would be the same as:

function(arg1 = z){
do stuff
}

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment