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