該練習(xí)答案如下
<!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ù)組長(zhǎng)度
?document.write(arr.length);
?
?//將數(shù)組內(nèi)容輸出,完成達(dá)到的效果。
?document.write(`<br/>`);
document.write(arr[0]);
document.write(`<br/>`);
document.write(arr[1]);
document.write(`<br/>`);
document.write(arr[2]);
document.write(`<br/>`);
document.write(arr[3]);
</script>
</head>
<body>
</body>
</html>
2020-09-23
2020-08-02
更簡(jiǎn)潔的代碼:
<!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ù)組長(zhǎng)度
?var len=arr.length;
?alert(len);
?//將數(shù)組內(nèi)容輸出,完成達(dá)到的效果。
for(var i=0;i<len;i++){
? ? document.write(arr[i]+'<br>');? ?
}
</script>
</head>
<body>
</body>
</html>
2020-08-02
所以為什么不用循環(huán)呢??
2020-07-15
題目要求用alert,輸出數(shù)組是var? arr = ['*','##',"***","&&","****","##*"];,雖然不驗(yàn)證答案也無所謂