The first one is not just an anonymous function, it's an "Immediately invoked function expression" (or IIFE for short).
The function itself is just what's inside the parenthesis and it won't execute by itself, you called it by defining it inside those parenthesis and then calling it through the ()
at the end of the expression, so in way, you still had to use ()
just like you did for the second one, it's just that, had you not done that, since it's nameless and not stored in a variable, constant or let, you would've had no way of referring to it later to execute it.
The second one is actually still an anonymous function, you just assigned it to a var instead of enclosing it in parenthesis and calling it right away.
A named function looks like this:
function startTick(){
...
}
Notice it's not assigned to a var or anything, rather, the name was defined after the function
keyword. One important difference is that you can call named functions in your code before the line where they are defined (more about that here: var functionName = function() {} vs function functionName() {}. More about functions in general here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions )