Skip to content

Instantly share code, notes, and snippets.

@christophergregory
Created October 16, 2012 17:15
Show Gist options
  • Save christophergregory/3900645 to your computer and use it in GitHub Desktop.
Save christophergregory/3900645 to your computer and use it in GitHub Desktop.
Callback function example
function callCallbackFunction (callback) {
callback(); // all this does is call the function that is passed in as a parameter
};
callCallbackFunction(function(){
alert('this is inside the callback function');
});
// Here is another way to do basically the same thing
var myFunction = function() {
alert('this is another way to call the function')
};
callCallbackFunction(myFunction);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment