Callback Examples
by Mike Gleeson
JavaScript
function thisIsAFunction()
{
alert("This is your callback");
}
function thisIsAFunctionWithParameters(string)
{
alert(string);
}
function thisIsAFunctionAcceptingCallbacks(callback, args)
{
if(callback){
if(args) callback(args);
else callback();
}
}
thisIsAFunctionAcceptingCallbacks(thisIsAFunction);
thisIsAFunctionAcceptingCallbacks(thisIsAFunctionWithParameters, prompt());