Generally, if the variable is declared through var but not initialized, the value of the variable is undefined, and the undefined variable needs to be determined in the form of & quot; typeof variable & quot, otherwise, an error occurs, for example:
If (! MyVar01) alert ("error occurred ");
// This Code directly causes an exception because the variable myVar01 does not declare if ("undefined" = typeof myVar01) alert ("error occurred ");
// This will not cause exceptions.
Var myVar01; if (undefined = myVar01) alert ("error occurred ");
// This code runs if ("undefined" = typeof myVar01) alert ("error occurred") correctly ");
// The Code will also run correctly
Conclusion: We use the following method to ensure that if ("undefined" = typeof myVar01) alert ("error occurred") is foolproof ");
// The Code will also run correctly
Of course, judging the effectiveness of data is far more than that, and there is also a null judgment, whether the number is too large.
Practical application:
Some downlm pages are not defined, but some pages are defined, so you can use such a judgment method. If there is no definition, it will not be executed.
If ("undefined "! = Typeof downlm) {if (downlm = "soft") {document. write ('success ');}}
The test is perfect.