callback()
callback() : a callback() function is a function passed into another function as a argument which is then invoked inside the outer function to complete the specific routing or action.
function greeting(name){
alert(hi, ${name});
}
function userInput(callback){
name= prompt('enter name');
callback(name);
}
userInput(greeting);
This is a syschronous callback(). It’s executed immediately
asynchronous means multiple executions are happening at the same time with different channel
Comments
Post a Comment