<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript for..in loop (iterates over an array)</title>
</head>
<body>
<pre> <!-- Use pre element for work document.writeln() method -->
<script type="text/javascript">
var domain = new Array(".com", ".net", ".org", ".gov");
for(var temp in domain){
document.writeln( domain[temp] );
}
</script>
</pre>
</body>
</html>