Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>The NodeList Object</h1>
<h2>The length Property</h2>
<!-- This is a comment node! -->
<p>The number of child nodes in the body element are:</p>
<p id="demo"></p>
<p>Whitespace between elements are text nodes. Comments are also nodes.</p>
<script>
const nodeList = document.body.childNodes;
let number = nodeList.length;
document.getElementById("demo").innerHTML = number;
</script>
</body>
</html>