You combine function expressions with function declarations.
Declares a variable foo and assigns an anonymous function to it:
var foo = function() {};
Declares a bar function in the current scope:
function bar() {};
Declares a baz variable and assigns a function named qux :
var baz = function qux() {};
Note that in this case, the function is not declared in this area. Only a variable is declared. It so happened that the name property of this function will be set to qux .
See this question .
Edit: code blocks Edit: added appropriate link
source share