Created
June 4, 2010 16:55
-
-
Save chrisjpowers/425658 to your computer and use it in GitHub Desktop.
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
function do_something(num, callback) { | |
// arbitrary logic here | |
num += 1; | |
// end arbitrary logic | |
return callback(num); // or you could do callback.call(this, num) | |
} | |
do_something(5, function(new_num) { | |
alert("After complex arbitrary logic, num is " + new_num); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment