Is just a function that executes after one other function that calls it, finishes?
Please I know (almost) nothing about programming, and I find it quite hard to find
Imagine you have some complex piece of code and right in the middle of it, you must do "something". The problem: You have no idea what "something" might be since that depends on how the code is used. Callback to the rescue.
Instead of having code, you just put a callback there. The user can supply her own piece of code and it will be executed just at the right time to do some critical thing. Example: jQuery.filter(callback)
.
jQuery (which you should have a look at) will call callback
for each element in a list. The callback function can then examine the element and return true
if it matches some criteria.
This way, we have the best of two worlds: The smart people at jQuery create the filter and you say what exactly to look for.