Misspelling Variables

Most scripting run-time errors can be attributed to misspelled variables. Microsoft® Visual Basic® Scripting Edition (VBScript) automatically declares unrecognized variables, which can lead to subtle errors in your code. To avoid this problem, use the Option Explicit statement as the first line of script on every page. The Option Explicit statement requires variables to be explicitly declared with a Dim statement.

Microsoft JScript® has no counterpart to the Option Explicit statement. Unrecognized variables are automatically declared when they are defined. Some ASP methods, such as Response.Write, produce script errors when used with an undeclared variable. If a variable is declared, but not defined, it will be returned either "Undefined" or "NaN." (For more information, see the JScript documentation.)