Basic JS question: .length

I’m trying to understand .length in a for loop. The list here ‘li’ has 5 items by the way.

Question 1: In this case, is liEven.length equal to 2 since there are 2 even items?

Question 2: if that’s the case, does that mean the loop will only run 1 time? (since i < liEven.length which is 2)

const liEven = document.querySelectorAll('li:nth-child(even)');

for(let i = 0; i < liEven.length; i ++){

   liEven[i].style.background = 'green';


Thank you for your help!

why don’t you check?
if you add console.log(liEven.length) you can answer the first

and if you add inside the loop console.log("loop executing", i) you can see how many times that appear in the console and the index