Possible Duplicate:
JavaScript: var functionName = function() {} vs function functionName() {}
AFAIK, there are two ways of creating functions:
function name()
{
}
and,
name = function()
{
}
I always use the second one as it seems much more intuitive.
What is the difference between these two ways of creating functions?
The difference is that first case function is defined at parse-time for a script block, whereas second case function is defined at run-time.
From here: var functionName = function() {} vs function functionName() {}