使用 For…In 声明来遍历数组内的元素使用 For…In 声明来遍历数组内的元素<html><body><script type="text/javascript">var xvar mycars = new Array()mycars[0] = "宝马"mycars[1] = "奔驰"mycars[2] = "宾利" for (x in mycars){document.write(mycars[x] + "<br />")}</script></body></html>