<html>
<body>
<h1>JavaScript 可迭代对象</h1>
<h2>遍历数组</h2>
<p id="demo"></p>
<script>
// 创建一个数组
const numbers = [2, 4, 6, 8];
// 列出所有元素
let text = "";
for (const x of numbers) {
text += x + "<br>";
}
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>