Created
March 19, 2012 18:02
-
-
Save shunchu/2121865 to your computer and use it in GitHub Desktop.
Passing arguments in JavaScript callbacks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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