I was wondering about how functions work in javascript, I noticed in some cases, things like array.sort, array.filter, and event listeners the code that calls (not declares) the function (not using functionless or inline), usually FunctionName have parenthesis with the arguments in there (FunctionName(arg1, arg2, arg3...)). Are parameters “automatically” passed into the function?
Now I understand, looking wikipedia's article on callback looking at the alert, it looks like it first calls "calculate" first, supplies the 2 numbers and the function (that function name only, without the open and then closing parenthesis), and THEN uses the parameters for callbackFunction. So without the parenthesis on the function name is like without using bracket on an array name.