<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript delete Operator</title>
</head>
<body>
<pre> <!-- Use pre element for work document.writeln() method -->
<script type="text/javascript">
var address = "63 street Ct.";
document.writeln("address :", delete address);
// Returns false, Using var keyword you can't delete
add = "63 street Ct.";
document.writeln("add :", delete add);
// Returns true, explicit declare you can delete
var myObj = new Object();
myObj.name = "Opal Kole";
myObj.age = 48;
myObj.married = true;
document.writeln("myObj.name :", delete myObj.name);
// delete object property
document.writeln("myObj['count']:", delete myObj["count"]);
// delete object property
var experience = [2010, 2011, 2012, 2013, 2014]; // array elements
document.writeln("experience[2] :", delete experience[2]);
// delete 2nd index from array elements
document.writeln("experience :", experience);
// [2010, 2011, undefined × 1, 2013, 2014]
</script>
</pre>
</body>
</html>