Basics: Javascript function as a variable?
Here is a code example from Mozilla about javascript closures:
function makeFunc() {
var name = "Mozilla";
function displayName() {
alert(name);
}
return displayName;
}
var myFunc = makeFunc();
myFunc();
Why do you return inner function displayName() as a variable displayName,
that is, without parentheses?
No comments:
Post a Comment