Typeof (VAR) is used to determine whether a variable is an array.
Javascript often requires operations on HTML controls. As you know, if the names of HTML spaces are the same,
You can use document. getelementsbyname to obtain an array.
If you want to use if (document. AAA. length! = "Undefined ").
If there are multiple controls (that is, arrays) on the page, an error is returned.
Use if (typeof (document. AAA. Length )! = 'Undefined ').
========================================================== ======================================
As for if (Var = 'undefined'), it is necessary to determine whether the variable is undefined, that is, whether it does not exist,
In the simplest example, your JS contains two functions: function a (A1, A2 ),
It has two parameters, A1 and A2, and function B (),
Call A: A (VAR) in B );
Only one parameter is passed to function A, and the A2 value in function a is undefined.