The advantage of this (called the "named functional expression") is that the function has an actual name. In your second version, the property has a name, but there is no function. Providing actual function names helps your tools help you (call stack lists, breakpoint lists, etc.). More: Anonymous Anonymous
The disadvantage of this is that it has unexpected results in some broken JavaScript machines, like IE8 and earlier. In IE8 and earlier, the Paul Irish version creates two separate functions two completely different times . But this is not a problem if you do not keep and use links for both of them, and expect them to be the same function (for example, when connecting and disconnecting event handlers). Given this Paul, I assume that he will not do this.
Enter the name of the question: note that this is not a function declaration, but you can be forgiven for thinking that it is because it looks almost the same as one. :-) This is a function expression. Function declarations and function expressions occur at completely different points in time and have different effects on the area in which they are created.
For completeness only:
source share