So I have some JavaScript included in my HTML document, which just creates an array and writes the length of it in the Console:
var Bulbs = document.getElementsByClassName("Bulb");
console.log(Bulbs.length);
The output I get is 0, but when I type Bulbs.length directly in the Console, I get 2 as an output. Why is this so?
My HTML code:
<header>
<div class="Bulb nav">
<a class="active">Hallo</a>
<a>Hallo</a>
<a>Hallo</a>
<a>Hallo</a>
</div>
<div class="Bulb additional">
<a>Impressum</a>
</div>
</header>