December 2017
Beginner
372 pages
10h 32m
English
A callback function is a function which is scheduled to be called after some asynchronous processing is completed. The callback functions are passed to another function as parameters which allows them to be called when the async processing is completed.
If you have used JavaScript before, then you will have definitely used callback functions in the form of timeout functions or interval functions, or even when you make a web service call. For example, if we write a setTimeout function, it calls another function after a specific period of time. This other function is a callback function. Take a look at the following code:
setTimeout(callback, 2000);function callback() { alert("Callback function called");}
In this code, we ...
Read now
Unlock full access