<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript array length property</title>
</head>
<body>
<pre>
<script type="text/javascript">
var normalArray= new Array();
normalArray[0] = ".com";
normalArray[1] = ".net";
normalArray[2] = ".org";
normalArray[3] = ".gov";
document.writeln("Length: " + normalArray.length);
// Outputs 4, array length
var associativeArray = new Array();
associativeArray['commercial'] = ".com";
associativeArray['network'] = ".net";
associativeArray['organization'] = ".org";
associativeArray['government'] = ".gov";
document.writeln("Length: " + associativeArray.length);
// Outputs 0, array length
</script>
</pre>
</body>
</html>