<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>数组循环方法</title>
<script type="text/javascript">
var arry=new Array();
for(var i=0; i<5; i++){
arry[i]=i;
}
//alert(arry.length); //数组长度为5
//数组循环方法(1)
for(var j=0; j<arry.length; j++){
//alert(arry[j]);
}
//数组循环方法(2)
for(k in arry){
alert(arry[k]);
}
</script>
</head>
<body>
</body>
</html>
时间: 2024-10-06 23:59:22