When you’re assigning a function to a variable, does it make any difference at all if you use a named instead of an anonymous function. The following generates an error that “foo() is not defined”.
var fn = function foo(){...};
foo();
Can anyone clear up what’s going on here?
You’re creating a named function expression.
Except in IE, the name is only visible inside the function.