Hi,
I’m sure I missed something or totally misunderstood, but I don’t get why we’re using variables instead of directly selecting the elements.
In this lesson, you set up a variable for the H1 and then use that with more variables that traverse to its parent.
var h1 = document.querySelector( 'h1' ),
h1ParentEl = h1.parentElement,
h1ParentNode = h1.parentNode;
Why aren’t we just selecting it directly? Something like:
document.getElementsByTagName(H1);
And then wouldn’t you just add the parent traversal? Like:
document.getElementsByTagName(H1).parentElement;
I’m a beginner with JavaScript so I probably just don’t comprehend anything yet.