You actually do not need to give the function a name:
or in your case:(function(){alert('Gotcha')})();
function sayHello(name){ var sayAlert; (function() { var text = 'Hello' + name; sayAlert = function() { alert(text) } })(); var text = 'How confused am I?'; sayAlert(); }
In reply to Re^2: "When closures capture their context" and "scope gotchas in Javascript"
by Jenda
in thread "When closures capture their context" and "scope gotchas in Javascript"
by clinton
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |