Say you have a function that performs some lengthy operation, such as sending emails. You do not want to wait for completion, so you will give it a callback function that will be called after its completion. This is the main use of callbacks - notification of asynchronous operations. There are other uses.
source
share