|Argument list:||anIndex||The index of the item to be deleted from the array|
|anObject||An object to be deleted|
|aProperty||An object property to be removed|
The delete operator is used to delete a property from an object or delete a reference to an object. It can also be used to delete an element from an array.
Using the new operator, a new object is created with a reference count of zero. Assigning that object creation to a variable increments the reference count. Saving it as an object property also increments the reference count. Storing it in an array does likewise.
All of these are simply references to the same object.
Deleting a variable containing a reference to an object decrements the reference count for that object.
The associativity is from right to left.
Refer to the operator precedence topic for details of execution order.
The delete operator will not work with MSIE version 3.02 or earlier. It also won't work in Netscape 2.02.
Netscape does not generate an error in version 3.0 if the delete operator is used but it is functionally ignored and does nothing.
There is some difference between Netscape and MSIE as to whether global variables can be deleted. The safest assumption is that they cannot, so to remain portable, your script should not try.
// Create a new object myObject = new Object; // Then delete a reference to it delete myObject;
ECMA 262 edition 2 - section - 11.1.4
ECMA 262 edition 2 - section - 11.4.1
ECMA 262 edition 3 - section - 11.4.1