contents   index   previous   next



global.undefine()

syntax:

undefine(value)

where:

value - value, variable, or property to be undefined.

 

return:

void.

 

description:

This function undefines a variable, Object property, or value. If a value was previously defined so that its use with the function global.defined() returns true, then after using undefine() with the value, defined() returns false. Undefining a value is different than setting a value to null.

 

The delete operator may be used only with properties of objects and elements of arrays and is more complete than undefine(). Two other techniques, using undefined and void, are equivalent to undefine(). The following three techniques for undefining test are equivalent:

 

var test = 111;

 

undefine(test);

test = undefined;

test = void test;

see:

global.defined(), delete operator, undefined

 

example:

// In the following fragment, the variable n

// is defined with the number value of 2 and

// then undefined.

var n = 2;

undefine(n);

 

// In the following fragment an object o

// is created and a property o.one is defined.

// The property is then undefined but

// the object o remains defined.

var o = new Object;

o.one = 1;

undefine(o.one);