Maybe an example will help?
So, the callback argument calledFunction() has the value callbackFunction , but if you notice, we are not calling the function yet, we pass a variable containing this function, and its arg function is just something before alert() . When calledFunction() is calledFunction() , it takes everything that was passed as the callback argument, and calls it with arg as its first and only argument.
Helped?
Edit: This works if you use function foo() {} -style declarations. (just in case, I donβt know how well you know JavaScript)
source share