DOM bug, pretty sneaky.
const items = document.querySelector('.todo li');
console.log(items.length);
Reply with what is broken and how you would fix it.
DOM bug, pretty sneaky.
const items = document.querySelector('.todo li');
console.log(items.length);
Reply with what is broken and how you would fix it.
this is like picking up one rupee in Zelda and declaring the wallet maxed lol
querySelector('.todo li') only gives you the first matching <li>, not a list, so items.length is gonna be undefined (or you’ll crash if it’s null). Swap it to querySelectorAll('.todo li') so you get a NodeList and then .length is the count.
:: Copyright KIRUPA 2024 //--