Returning inside of a callback

When you return something inside of a callback function, it gets returned directly from the callback of the function you executed.

For example,

1) we provide a function definition for func1’s callback parameter.

2) func1 runs its implementation and then executes the callback.

3) goes into the callback and executes code

4) we return a string inside of the callback function.

5) it gets returned from the callback inside of func1