So I understand that callbacks are essentially functions that are passed into another function and executed at a later time.
I am also aware that a lot of major libraries such as jQuery use callbacks efficiently, but I wanted a simple code example along with an explanation on when it is best to use a callback function to solve a problem. All the examples I ve seen so far are the setTimeout, but I wanted to see a fresh example to broaden my mind on how callback functions can be used.
So utimately, I wanted to see
1. An example of a callback function.
2. Why it would be an appropriate solution/approach in that example.
3. Possibly other common reasons/scenarios for using callbacks.
Thank you very much in advance!