Comment from Richard
Hi guys, I am an experienced developer with just a basic understanding of Javascript (enough to do client validation etc) but for the most part, most of my dev is on the server side. My question: I...
View ArticleComment from Roger
I admit to being a novice with JavaScript, but... so far, not a single example that I've found on Google of changing a value of a global var by means of a function has ever worked.
View ArticleComment from Jonathan Snook
You can always contain your code down to just one global variable. In the case of this site, all my custom code is contained in the SNOOK variable.
View ArticleComment from Mr. Ignition
Global variables are hard too avoid in JavaScript. People can say they're bad and all but who here can look at the source for their site and not have any global JS variables?
View ArticleComment from dj
How can you avoid using so-called globals in situations like this ... For instance, I have an array of values that I need for some widget on the page. The user can click a button and retrieve new...
View ArticleComment from FYRe
With declared global variables, how do I set them as an id for (Eg. a checkbox). ---------------------------------------------- eg: <script language="JavaScript"> var num1 = 0; function...
View ArticleComment from Garrett
David - You're right, but I still shy away from them because I tend to lean on the side of purist. Plus, as everybody is getting on the AJAX bandwagon, pages can get fairly complex, and even only being...
View ArticleComment from David ODonnell
Garrett, what you say is generally true for server-side programming languages, but in javascript nothing is really "global" because they are only in scope for the lifetime of the page. @jonathan - i...
View ArticleComment from Garrett Dimon
Not to be overly pedantic, but global variables should kind of be a last resort. This is the case with almost any programming language really. It's kind of like playing with fire. This isn't meant to...
View ArticleComment from Jonathan Fenocchi
Other tips? Seldom, if ever, is the eval() method necessary. I see people using it all the time to declare variables, and while I would much rather use an array, if you really find it necessary to...
View Article