仅供同学参考,如果有更好的方法,烦请告诉我怎么优化,谢谢
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script type="text/javascript">
var arr = ['*','##',"***","&&","****","##*"];
arr[7] = "**";
var j=0;
for( i=0;i<arr.length;i++){
j++;
if(j%2!=0&&arr[i] != null){
document.write(arr[i]+"<br>");
if(j==1){
document.write(arr[7]+"<br>");
}
}
}
</script>
</body>
</html>