Function - Callback function
Table of Contents
1 - About
A callback function is called back by the higher-order function that takes it as parameter.
Callbacks is a method of enabling asynchrony (asynchronous operation).
A callback is a function that is passed as an argument to another function and is executed after its parent function has completed.
A callback function is generally used as event handler to respond to an event.
2 - Articles Related
3 - Example
Basic example in Javascript.
callback = function () {
console.log("Hello Callback");
}
function highOrder(callbackFunctionToCall){
// Call the callback function
callbackFunctionToCall();
}
highOrder(callback);
4 - Hell
The callback hell is when there is so much callback that it build a multiple levels of nested callbacks rendering the code difficult to understand.