This documentation is archived and is not being maintained.

undefined Property 

Returns the value of undefined.


The undefined property is a member of the Global object, and becomes available when the scripting engine is initialized. When a variable has been declared but not initialized, its value is undefined.

If a variable has not been declared, you cannot compare it to undefined, but you can compare the type of the variable to the string "undefined". Undeclared variables cannot be used in fast mode.

The undefined property is useful when explicitly testing or setting a variable to undefined.

The following example illustrates the use of the undefined property:

var declared;                         //Declare variable.
if (declared == undefined)            //Test variable.
   print("The variable declared has not been given a value.");

The output of this code is:

The variable declared has not been given a value.