This is an anti pattern in JavaScript (don't do this):
The preferred way of declaring a JavaScript function is creating anonymous function and assigning it to a variable:
Benefits of this type of function declaration are:
1. Makes it easier to understand "functions as an object".
2. It enforces good semicolon habits.
3. Doesn't have much of the baggage traditionally associated with functions and scope.
Also we can declare named function expression as follows:
1. Provides the debugger with an explicit function name: helps stack inspection.
2. Allows recursive functions: someFunction can call itself.
But with this type of function declaration there are historic quirks with IE.