This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.



Deletes a property from an object, or removes an element from an array.


delete expression


The following example shows how to remove an element from an array.

// Create an array.
 var ar = new Array (10, 11, 12, 13, 14);

 // Remove an element from the array.
 delete ar[1];

 // Print the results.
 document.write ("element 1: " + ar[1]);
 document.write ("<br />");
 document.write ("array: " + ar);
 // Output:
 //  element 1: undefined
 //  array: 10,,12,13,14

The following example shows how to delete properties from an object.

// Create an object and add expando properties.
 var myObj = new Object(); = "Fred";
 myObj.count = 42;

 // Delete the properties from the object.
 delete myObj["count"];

 // Print the results.
 document.write ("name: " +;
 document.write ("<br />");
 document.write ("count: " + myObj.count);
 // Output:
 //  name: undefined
 //  count: undefined


The expression argument is a valid JavaScript expression that usually results in a property name or array element.

If the result of expression is an object, the property specified in expression exists, and the object will not allow it to be deleted, false is returned.

In all other cases, true is returned.


  • Microsoft Developer Network: Article