Skip to content

Instantly share code, notes, and snippets.

@attilaking
Created March 14, 2020 11:43
Show Gist options
  • Save attilaking/570856920dfe7f9fce77861355bc177c to your computer and use it in GitHub Desktop.
Save attilaking/570856920dfe7f9fce77861355bc177c to your computer and use it in GitHub Desktop.
[Callback] Callback#callback
// add() function is called with arguments a, b
// and callback, callback will be executed just
// after ending of add() function
function add(a, b , callback){
document.write(`The sum of ${a} and ${b} is ${a+b}.` +"<br>");
callback();
}
// disp() function is called just
// after the ending of add() function
function disp(){
document.write('This must be printed after addition');
}
// Calling add() function
add(5,6,disp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment