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() This way, when you look at the stack trace, you'll see function obj_method instead of anonymous.
statements at global scope create globals that aren't properties of the global object; a new concept in ES2015.) (There's also the horror of implicit globals, but don't do it on purpose and do your best to avoid doing it by accident, perhaps by using ES5's UPDATE1: If you read the comments there's a nice discussion around this particular naming convention. UPDATE3: Here is the additional wikipedia post that supports my point: ..to answer the main question.
UPDATE2: It seems that since my answer has been posted the naming convention has gotten more formal.
I've seen function refs nested in function refs as the developer realized that more callbacks were needed in subsequent steps.
Instead of this tree based logic, I prefer the organization of isolated functions.
In this case, we are creating a reference to that function (as an event handler) and therefore "A" will remain in memory until that event handler is cleared. It does not matter whether we used a statement or an expression; what matters is if a reference to that function is created in "do Stuff"!