<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数组</title>
<script type="text/javascript">
//创建数组
var myarr = ["*","##","***,""&&","****","##*"];
myarr[7]="**";
//显示数组长度
document.write(myarr.length);
//将数组内容输出,完成达到的效果。
document.write(myarr[0]+"<br/>");
document.write(myarr[7]+"<br/>");
document.write(myarr[2]+"<br/>");
document.write(myarr[4]+"<br/>");
</script>
</head>
<body>
</body>
</html>
直接把斜杠去了就行了
//创建数组
var myarr = ["*","##","***,""&&","****","##*"];
上面创建数组""&&"错了,导致页面不显示,,应该是"&&",如下:
var myarr =["*","##","***,"&&","****","##*"];
<br/>换成</br>
//创建数组
var myarr = ["*","##","***,""&&","****","##*"];
是因为这句里面 "***,""&&" 逗号写到双引号里去了,
和下面的html语句无关,<br/>是正确的写法。
里面那个换行符应该是</br>,你改了之后应该就可以了
</br>应该写在外面
document.write(arr[2]);</br>