[thelist] JS: global vars...

Hershel Robinson hershelr at netvision.net.il
Tue Sep 2 14:38:54 CDT 2003


> page with all different kinds of values. So you can imagine I have a
> whole library of functions to deal with the data.

I actually try to avoid imagining what you do over there, Tom. ;

> In these cases I have been using the (sometimes called evil) global
> variable. That way the 2nd function can read the data it needs.
>
> So! My question is what are the cons of this approach? The bonus is
> that it makes it very easy for me to read/write the values.

I also work on somewhat large pages with somewhat large amounts of data and
quite large code libraries. On some of these pages, I use global variables.
I do not consider them evil, personally. When used appropriately, they can
be quite effective--I find that they save me time coding and they do
precisely what I need them to--hold global bits of information.

I think that if a datum IS indeed global, then it probably BELONGS in a
global variable. I await, however, the dissenting opinions. :)

Hershel



More information about the thelist mailing list