[Javascript] Why won't this work????

Hassan Schroeder hassan at webtuitive.com
Wed Jan 29 16:05:03 CST 2003


Peter Brunone wrote:
> Ah, the age-old problem of shared indices... this one still 
 > bites me every now and then.
> 
> You are using the variable "i" to denote an index of the fieldnames 
 > array... but then when you go to check for bad characters, you are
 > using that same variable as the loop index...

which is exactly why it's good practice to not use cryptic variables
like "i" and "j" and "x" at all, but use something like "fieldCount",
"badCharArrayCount", etc.

And when you're back digging around in the code 6 months later, it'll
make a lot more sense, too :-)

-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.






More information about the Javascript mailing list