Struggling with why .innerHTML shows undefined, yet .length shows 1.
var content = document.getElementsByTagName("h1");
console.log(content.innerHTML);
console.log(content.length);
<h1>Hello World</h1>
<ul>
<li>This is an item</li>
<li>This is another item</li>
</ul>
getElementsByTagNamereturns a list. So you want index 0 of the result, like this:document.getElementsByTagName("h1")[0].innerHTML