JavaScript DHTML/Language Basics/delete
Delete operator on Object
<source lang="html4strict">
<html> <head>
<title>The Delete Operator</title> <script type = "text/javascript" > var aObject = {}; aObject["A"] = new Object; aObject["B"] = new Object; aObject["C"] = new Object; aObject["D"] = new Object; aObject["A"].myValue = "a"; aObject["B"].myValue = "b"; aObject["C"].myValue = "c"; aObject["D"].myValue = "d"; </script>
</head> <body id = "mainbody"> <script type = "text/javascript">
delete(aObject["A"].myValue); for (obj in aObject) { var para = document.createElement("paragraph"); para.id = obj; para.appendChild(document.createTextNode(obj + ": " + aObject[obj].myValue)); document.getElementsByTagName("body")[0].appendChild(para); }
</script> </body> </html>
</source>