If we need to know if a variable is defined or undefined, we can use the method IsDef.
This method requires a string called name as a parameter and returns the true value if a variable with identifier name exists, or false if no variable with identifier name exists. Example:
Notice that the IsDef function, unlike Undef, does not take an object as parameter, but rather a string containing the object name. This avoids an error condition if the variable has never been defined. In the case of the Undef function, an error condition should occur, because it is not legal to invoke Undef on an undefined object.