Deletes a property from an object, or removes an element from an array.
Syntaxdelete expression
Examples
The following example shows how to remove an element from an array.
var ar = new Array (10, 11, 12, 13, 14);
delete ar[1];
document.write ("element 1: " + ar[1]);
document.write ("<br />");
document.write ("array: " + ar);
The following example shows how to delete properties from an object.
var myObj = new Object();
myObj.name = "Fred";
myObj.count = 42;
delete myObj.name;
delete myObj["count"];
document.write ("name: " + myObj.name);
document.write ("<br />");
document.write ("count: " + myObj.count);
Remarks
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.
AttributionsMicrosoft Developer Network: Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4