definition - What is a callback? - Stack Overflow A callback is the building block of asynchronous processing Think of it this way: when you call someone and they don't answer, you leave a message and your phone number Later on, the person calls you back based on the phone number you left A callback works in a similar manner
How to access the correct `this` inside a callback The first one binds this with a callback inside the method itself And for the second one, the callback is passed with the object bound to it p1 sayNameVersion1(niceCallback) pass simply the callback and bind happens inside the sayNameVersion1 method p1 sayNameVersion2(niceCallback bind(p1)) uses bind before passing callback