Result Size: 625 x 534
x
 
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript 数组</h2>
<p>遍历数组的最佳方法是使用标准的 for 循环:</p>
<p id="demo"></p>
<script>
var fruits, text, fLen, i;
fruits = ["香蕉","橙子","苹果","芒果"];
fLen = fruits.length;
text = "<ul>";
for (i = 0; i < fLen; i++) {
  text += "<li>" + fruits[i] + "</li>";
}
text += "</ul>";
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>