I now what's a callback fn and how it works, but I don't seem to understand how it gets called in jQuery, for example:
$('#btn').click(function(){
alert('Test');
});
I know that when the click method had finished executing, then the callback fn gets called, but I just don't understand how is that anonymous callback fn called.
In this example:
function Greeting(function(){alert('Callback fn inside Greeting');}){
alert('Inside Greeting fn');
}
I'd assume that after the alert inside Greeting had been display, THEN my callback fn will get called, but it doesn't. I just see this error "uncaught syntax error: unexpected token function". My question is, how do I call the anonymous callback fn that I have as a parameter in Greeting fn? Thanks in advance.
this section is used to pass arguments/values) into the function.