Share via


undefined Property (JScript 5.6) 

Returns an initial value of undefined.


undefined

Remarks

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"

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

Example

var declared;                         //Declare variable.

if (declared == undefined)            //Test variable.

  document.write("declared has not been given a value.");



if (typeof(notDeclared) == "undefined")

  document.write("notDeclared has not been defined.");

Requirements

Version 5.5

Applies To: Global Object (JScript 5.6)

See Also

Reference

typeof Operator (JScript 5.6)