I had never seen this syntax before, but used it in all of Angular's source code.
function something() {
return function foo() {
};
}
var x = something();
From what I can say, it is foo()used as a closure function, but why does the function have a name? I thought the close function has invalid syntax, but it works fine in the browser.
Is there anything else between the code above and below? if so, then what?
function something() {
return function() {
};
}
var x = something();
source
share