PDA

View Full Version : Any Apparent Dangers in Declaring Multiple Variables Globally?



tanske
12 Jul 2011, 6:26 PM
Hi All,

I made a similar post in the ExtJS2.2 sub-forum but I would like to hear the various opinions on Extjs 3.x specifically. So here it goes:

I am thinking of implementing all variables as "global variables" so that instead of initializing local variables in a return function and failing to destroy them, the code would call a function to destroy the global variable upon a completion action, like closing a window.

The actual question is:

Any issues or problems or things to take note if I were to switch to an ALL global variable approach?

thanks.

varunach
12 Jul 2011, 10:12 PM
Memory issues, security, and the worst one.. you'll have keep track of the variable names that you use..

Uberdude
13 Jul 2011, 1:01 AM
Awful idea, please read Douglas Crockford's excellent book "Javascript: The Good Parts" so you never think to do this again.

mitchellsimoens
13 Jul 2011, 4:53 AM
Double posting is not a good thing to do either. I have deleted your post on the same matter from the GXT forum