新建数组,添加元素,遍历数组:

 

<!DOCTYPE html>
<html>
<head>

<script type="text/javascript">
	function processClick()
	{
		var arr = new Array();
		arr.push("abc");
		arr.push("def");
		
		for(var i=0;i<arr.length;i++)
		{
			alert(arr[i]);
		}
	}
</script>

</head>
	
<body>

<div style="width:1920px;min-height:1080px" >
	<a href="#" onClick="processClick();">show</a>
</div>

</body>
</html>

 

新建数组还可以通过如下方式:

<script type="text/javascript">
	var arr = [];
	var arr = ["1","xy","ss"];
	var arr = new Array("1","xy","ss");
	var arr = new Array(5);
</script>