Skip to content

Instantly share code, notes, and snippets.

@shunchu
Created March 19, 2012 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shunchu/2121865 to your computer and use it in GitHub Desktop.
Save shunchu/2121865 to your computer and use it in GitHub Desktop.
Passing arguments in JavaScript callbacks
http://stackoverflow.com/questions/3458553/javascript-passing-parameters-to-a-callback-function
function tryMe (param1, param2) {
    alert(param1 + " and " + param2);
}
function callbackTester (callback) {
    callback (arguments[1], arguments[2]);
}
callbackTester (tryMe, "hello", "goodbye");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment