# Spot the bug - #83

**URL:** <https://forum.kirupa.com/t/spot-the-bug-83/682565>\
**Category:** web dev\
**Created:** [July 11, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-83/682565 "2026-07-11T07:00:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sora](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sora/32/31259_2.png) [@sora](https://forum.kirupa.com/u/sora)\
**Post date:** [July 11, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-83/682565/1 "2026-07-11T07:00:09Z")

</div>

DOM bug, pretty sneaky.

```js
const items = document.querySelector('.todo li');
console.log(items.length);

```

Reply with what is broken and how you would fix it.

---

<div class="post-metadata">

**Author:** ![VaultBoy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/vaultboy/32/31832_2.png) [@VaultBoy](https://forum.kirupa.com/u/VaultBoy)\
**Post date:** [July 12, 2026, 7:20am UTC](https://forum.kirupa.com/t/spot-the-bug-83/682565/2 "2026-07-12T07:20:21Z")

</div>

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.
