<html>
<body>
<!-- This is a comment node! -->
<h1>The Element Object</h1>
<h2>The forEach() Method</h2>
<p>Whitespace between elements are text nodes. Comments are also nodes.</p>
<p>The body element's child nodes are:</p>
<p id="demo"></p>
<script>
const list = document.body.childNodes;
let text = "";
list.forEach(
function(node, index) {
text += index + " " + node + "<br>";
}
);
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>