in reply to Re: "When closures capture their context" and "scope gotchas in Javascript"
in thread "When closures capture their context" and "scope gotchas in Javascript"
function sayHello(name) { var sayAlert; var text = 'Hello ' + name; sayAlert = function() { alert(text); } var new_text='How confused am I?'; sayAlert(); } sayHello('Bob');
Not a terribly meaningful example because I don't actually USE new_text, but...
Perl++ for DWIM!
|
|---|