<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript delete array element</title>
</head>
<body>
<pre> <!-- Use pre element for work document.writeln() method -->
<script type="text/javascript">
// Press F12 - View result on Console Panel
var domain = new Array(".com", ".net", ".org", ".gov");
domain[4] = ".int"; // add new array element
document.writeln( domain );
delete domain[4]; // return true
document.writeln( domain[4] ); // undefined
document.writeln( domain );
document.writeln( "length: " + domain.length );
// length 5
console.log( domain );
// console - [".com", ".net", ".org", ".gov", undefined × 1]
</script>
</pre>
</body>
</html>