Subj : Closures and Mozilla (possible error?) To : netscape.public.mozilla.jseng From : svendtofte@svendtofte.com (svend) Date : Sat Apr 19 2003 12:55 pm Hello everyone, My apologies, if this is not the correct forum for this, but I'm not sure where else to look, please treat the post accordingly :) I'm trying to understand closures in JavaScript, and made this rather construed example: The problem, is that depending on if the "insideFunc();" line is run or not, the alerts shows different messeges. The above will show: hidden has value: haha setting 'hidden' to 'svend' defining 'outSideFunc' hidden has value: haha hidden has value: haha setting 'hidden' to 'tofte' hidden has value: haha uncommenting the line, will show: setting 'hidden' to 'svend' defining 'outSideFunc' hidden has value: svend setting 'hidden' to 'tofte' hidden has value: svend Which is what I'd expect, but whether the line is run or not, it shouldn't change the central alerts (right?). IE 6 and opera 7.1 are both consistent here. So maybe someone here, can tell me what's going on? Regards, Svend Tofte .