This is using a function expression: If the name is specified (the text after "function" but before the parenthesis) then it is a named function regardless of whether it is inline or declared separately. points out that IE mishandles named function expressions in a non-trivial way (See: and this is important to note, I'm simply trying to make a point about the terminology. In response to your direct question, you should use a named function statement if the function could ever be used from any other place in your code.If the name is not specified then it is "anonymous". If the function is being used in exactly one place and has no relevance anywhere else then I would use a function expression unless it is prohibitively long or otherwise feels out of place (for style reasons).function some Fn() function some Fn() //an example where you would prefer (/ utilize) the hoisting.function some Fn() This way, when you look at the stack trace, you'll see function obj_method instead of anonymous.//an example where you wold prefer to use an anonymous function.//you can assign this (anonymous) function to a variable, so you get your "name" back.(Proof, try it in IE9 or earlier and also in just about any other browser.) IE gets it wrong in two ways: 1. As a consequence of one of those, it "bleeds" the name symbol into the enclosing scope of the expression (in clear violation of Section 13 of the specification).
One important use of an Anonymous Function is when you need to pass scoped data into your function call, but then I usually just wrap my function into the anonymous function.
For very simple or obvious breaking funcs, I suppose it's not a big deal but to me it's like semis.
I really don't care what the other guy does if it doesn't cause pain but I try to always name my funcs because it's not hard and it can be an advantage.
I like to help my tools help me, and so I mostly avoid anonymous functions as my tools can't give me meaningful information about them (for instance, in a call stack list in a debugger, etc.). Rules are meant to be broken, though, not slavishly bowed to.
:-) Note that according to the specification, there's a third alternative: You can have an inline function that also has a name: incorrectly and creates two completely distinct functions at different times.