<!DOCTYPE html>
<html>
<body>
<h1>JavaScript 配列</h1>
<h2>The forEach() メソッド</h2>
<p>配列要素ごとに関数を1回呼び出します。</p>
<p id="demo"></p>
<script>
const numbers = [45, 4, 9, 16, 25];
let txt = "";
numbers.forEach(myFunction);
document.getElementById("demo").innerHTML = txt;
function myFunction(value, index, array) {
txt += value + "<br>";
}
</script>
</body>
</html>