Skip to content

Instantly share code, notes, and snippets.

@chrisjpowers
Created June 4, 2010 16:55
Show Gist options
  • Save chrisjpowers/425658 to your computer and use it in GitHub Desktop.
Save chrisjpowers/425658 to your computer and use it in GitHub Desktop.
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