I am running the following script:
const myVar = document.getElementsByClassName('pricing-custom-header-links');
console.log(myVar);
console.log(myVar[0]);
and I get the output:
----------------------------------------
HTMLCollection []
0: li.headerLink.vdm.keep.pricing-custom-header-links
1__proto__: HTMLCollection
-----------------------------------------
undefined
-----------------------------------------
This seems to make no sense. The first log tells me that we have an array-like object, with the correct element that I want to target. Great. Then when I try to get access to that element explicitly, it tells me it's undefined and that there is no element there. Any reason why this is happening?