August 1999
Intermediate to advanced
1488 pages
72h 53m
English
delete property
The delete operator deletes properties from objects and array elements from arrays by making them undefined. Actual memory deallocation is done by JavaScript garbage collection. Some objects, such as variables created by the var statement, are not affected by the delete operator.
Caution
Prior to JavaScript 1.2, the delete operator set the object property to null rather than undefined.
The code in Listing 6.115 demonstrates how to use the delete operator to delete a Date object. Notice that the last document.write() statement does not write anything to the browser because theDate is undefined after using the delete ...
Read now
Unlock full access