This documentation is archived and is not being maintained.
delete Operator
Visual Studio 2010
Deletes a property from an object, removes an element from an array, or removes an entry from an IDictionary object.
delete expression
The following example illustrates a use of the delete operator.
// Make an object with city names and an index letter.
var cities : Object = {"a" : "Athens" , "b" : "Belgrade", "c" : "Cairo"}
// List the elements in the object.
var key : String;
for (key in cities) {
print(key + " is in cities, with value " + cities[key]);
}
print("Deleting property b");
delete cities.b;
// List the remaining elements in the object.
for (key in cities) {
print(key + " is in cities, with value " + cities[key]);
}
The output of this code is:
a is in cities, with value Athens b is in cities, with value Belgrade c is in cities, with value Cairo Deleting property b a is in cities, with value Athens c is in cities, with value Cairo
Show: