<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数组</title>
<script type="text/javascript">
//创建数组
var arr = ['*','##',"***","&&","****","##*"];
arr[1] = '**';
arr[3] = '****';
//显示数组长度
alert("数组长度为:"+arr.length);
//将数组内容输出,完成达到的效果。
for(var i = 0; i < 4; i++){
document.write(arr[i] + '<br />');
}
</script>
</head>
<body>
</body>
</html>
我的是对的
<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数组</title>
<script type="text/javascript">
//创建数组
var arr = ['*','##',"***","&&","****","##*"];
arr[7] = "**";
//显示数组长度
alert(arr.length);
//将数组内容输出,完成达到的效果。
for(i=0;i<arr.length;i++){
document.write(arr[i]+"<br/>");
}
</script>
</head>
<body>
</body>
</html>
var arr = ['*','##',"***","&&","****","##*"];
arr[7] = "**";
//显示数组长度
//将数组内容输出,完成达到的效果。
for(var i=0;i<6;i++){
if(i==1){
document.write(arr[7]+"<br/>");
}
if(i%2==0){
document.write(arr[i]+"<br/>");
}
}
<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数组</title>
<script type="text/javascript">
//创建数组
var myarr=['*','**','***','****'];
for(var i=0;i<myarr.length;i++){
document.write(myarr[i]+"<br>");
}
</script>
</head>
<body>
</body>
</html>