Subj : RE: variables and scopes To : netscape.public.mozilla.jseng From : Stuart Date : Thu Sep 23 2004 12:34 pm Igor, Thanks again! I tried reading the ECMA spec but .... Arrr it was not fun reading. I am surprised at how tricky some of JS, I always thought of it as a simple version of java! I will modify my code to use the setParent and to call setPrototype(null). Other than the 'side-effect' that the any variables created without the var will always get put in the top most parent scope are there any other possible issues I might bump into? Cheers, Stuart p.s. When the product is finished I'll try and get you some product description to put on your web site so that you know all your help was not wasted! -----Original Message----- From: mozilla-jseng-admin@mozilla.org [mailto:mozilla-jseng-admin@mozilla.org]On Behalf Of Igor Bukanov Sent: Thursday, September 23, 2004 11:26 AM To: mozilla-jseng@mozilla.org Subject: Re: variables and scopes Stuart wrote: > Igor, > > I forgot to add my key problem is, how can I modify my scopes so that the > script would update the variable in the application scope: > > rootCounter = Number(rootCounter) + Number(1) If you want to force numeric semantic of "+" then rootCounter = Number(rootCounter) + 1 is enough. > > Would I need to change the scopes so that they use setParent rather than > setPrototype? Yes, but do not forget to call .setPrototype(null) in that case. Regards, Igor _______________________________________________ mozilla-jseng mailing list mozilla-jseng@mozilla.org http://mail.mozilla.org/listinfo/mozilla-jseng .