<script type="text/javascript"> var i; var book = new Array("java","javascript","Html"); for(i in book){ document.write(book[i]); document.write("<br>"); } </script>
for (变量 in 对象) { 在此执行代码 }
“变量”用来指定变量,指定的变量可以是数组元素,也可以是对象的属性。
<script type="text/javascript"> var i; var book = new Array("java","javascript","Html"); for(i in book){ document.write(book[i]); document.write("<br>"); } </script>
for (变量 in 对象) { 在此执行代码 }