Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<!-- This is a comment node! -->
<h1>The Element Object</h1>
<h2>The entries() Method</h2>
<p>Whitespace between elements are text nodes. Comments are also nodes.</p>
<p>The body element's child nodes values are:</p>
<p id="demo"></p>
<script>
const list = document.body.childNodes;
let text = "";
for(let x of list.entries()) {
  text += x[0] + " " + x[1].nodeValue + "<br>";
}
document.getElementById("demo").innerHTML = text;
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_nodelist_entries_values by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 05 Sep 2022 15:19:30 GMT -->
</html>