1. 程式人生 > >數組循環累加

數組循環累加

shu rip += script set ++ var asc html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>數組練習</title>
</head>
<body>
<script type="text/javascript">
var he=‘‘;
var shuzu = new Array();
shuzu[0] = ‘彩筆1‘,
shuzu[1] = ‘彩筆2‘,
shuzu[2] = ‘彩筆3‘,
shuzu[3] = ‘彩筆4‘;

//數組循環累加
for(var i = 0 ; i<shuzu.length;i++){
he+=shuzu[i];
alert(he)
}


</script>
</body>
</html>

數組循環累加