There is a subtle bug here.
const list = document.createElement('ul');
list.innerHTML = '<li>One</li><li>Two</li>';
document.body.appendChild(list);
const items = list.querySelectorAll('li');
for (let i = 0; i <= items.length; i++) {
items[i].classList.add('active');
}
Reply with what is broken and how you would fix it.
WaffleFries