Created
October 16, 2012 17:15
-
-
Save christophergregory/3900645 to your computer and use it in GitHub Desktop.
Callback function example
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 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