delete 연산자

개체에서 속성을 삭제하거나, 배열에서 요소를 제거하거나, IDictionary 개체에서 항목을 제거합니다.

delete expression

인수

  • expression
    필수적 요소로서, 결과가 속성 참조, 배열 요소 또는 IDictionary 개체인 모든 식입니다.

설명

expression의 결과가 개체이고, expression에 지정된 속성이 존재하며, 개체에서 삭제가 허용되지 않으면 false가 반환됩니다.

다른 모든 경우에는 true가 반환됩니다.

예제

다음 예제에서는 delete 연산자가 사용되는 경우를 보여 줍니다.

// 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]);
}

이 코드는 다음과 같이 출력됩니다.

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

요구 사항

버전 3

참고 항목

참조

IDictionary

개념

연산자 우선 순위

연산자 개요