if (h1Element.nextSibling.nodeType == 1) {
// An elements node type is 1, text nodes are 3
// If the nextSibling's nodeType is 1, you assign that sibling's reference to pElement. If not, you get the next sibling (the <p> element) of h1Element's sibling (the whitespace text node). pElement = h1Element.nextSibling; } else { pElement = h1Element.nextSibling.nextSibling;
// This is the code that runs and assigns pElement to paragraph1 } example3d.innerText = pElement; } </script>