這樣寫行不行
<!DOCTYPE? HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>數(shù)組</title>
<script type="text/javascript">
?//創(chuàng)建數(shù)組
?var arr=["*","##","***","&&","****","##*"]
?//顯示數(shù)組長度
?arr[7]="**";
?document.write(arr.length+"</br>");
?//將數(shù)組內(nèi)容輸出,完成達(dá)到的效果。
?for(var i=0;i<arr.length&&arr[i]!=null;i=i+2){ //選出偶數(shù)位,并排除空值
? ? ?document.write(arr[i]+"</br>"); //輸出星星
? ? ?if(arr[i]=="*"){ //插隊(duì)輸出第二顆星
? ? ? ? ?document.write(arr[7]+"</br>");
? ? ?}
?}
</script>
</head>
<body>
</body>
</html>
2020-04-28
<!DOCTYPE? HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>數(shù)組</title>
<script type="text/javascript">
?//創(chuàng)建數(shù)組
?var? arr = ['*','##',"***","&&","****","##*"];
?arr[7] = "**";
?//顯示數(shù)組長度
?alert(arr.length);
?//將數(shù)組內(nèi)容輸出,完成達(dá)到的效果。
document.write(arr[0]+"<br/>");
document.write(arr[7]+"<br/>");
document.write(arr[2]+"<br/>");
document.write(arr[4]+"<br/>");
</script>
</head>
<body>
</body>
</html>
2020-03-28
這樣寫不復(fù)雜嗎?
2020-03-14
okk!