
Option Explicit statement
Well...not quite. JScript will allow you to make assignments to undeclared
variables (at which time they fall into the global namespace), but balks when
you attempt to reference variables that are both undeclared and unassigned. Note
this example:
var var1
var2 = someValue
if (var1) doSomething()
if (var2) doSomethingElse()
if (var3) doSomethingElseEntirely()
Assuming var1, var2 and var3 are all undeclared prior to this block, only the
last line will produce an error.
Quote:
> The nice thing about JScript vs. VBScript is that JScript will
> complain if you try to use a variable that hasn't been defined.
> VBScript by default will just create it for you with no
> complaint, and that behavior is what makes Option Explicit so
> essential to VBScript programming.
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use of
this email address implies consent to these terms. Please do not contact me
directly for assistance. If your question is worth asking, it's worth posting.