「JavaScript入門」delete演算子の使い方

1.オブジェクトのプロパティを削除
var ttObj = {};
ttObj.t = “this is a test";
delete ttObj.t;

2.暗黙的に定義される変数とユーザ定義のプロパティを削除
i = 10;
tObj = {
a: 4,
xxxx
};
delete i; // true
delete tObj.a; // true
delete tObj; // true

3.配列の要素の削除
var ssArr = [“element1″,"element2″,"element3″,"element4″,"elment5"];
delete ssArr[2];

JavaScript

Posted by arkgame