<meta charset="utf-8" />
<script language="javascript">
<!--
var arr = new Array("苹果","香蕉","梨子");
for(n = 0;n < arr.length;n++)
{
document.write("<h1>for语句遍历数组</h1>");
document.write(arr[n] + "<br />");
}
var n = 0;
while(n < 3)
{
document.write("<h1>while语句遍历数组</h1>");
document.write(arr[n] + "<br />");
}
for(n in arr)
{
document.write("<h1>for-in语句遍历数组</h1>");
document.write(arr[n] + "<br />");
}
-->
</script>
这段代码我是按照视频上敲的,但是不仅仅执行不出来,而且稍微等一下,会让电脑慢慢卡死,求解……
<script language="javascript">
<!--
var arr = new Array("苹果","香蕉","梨子");
for(n = 0;n < arr.length;n++)
{
document.write("<h1>for语句遍历数组</h1>");
document.write(arr[n] + "<br />");
}
var n = 0;
while(n < 3)
{
document.write("<h1>while语句遍历数组</h1>");
document.write(arr[n] + "<br />");
}
for(n in arr)
{
document.write("<h1>for-in语句遍历数组</h1>");
document.write(arr[n] + "<br />");
}
-->
</script>
这段代码我是按照视频上敲的,但是不仅仅执行不出来,而且稍微等一下,会让电脑慢慢卡死,求解……