# Spot the bug - #76

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

<div class="post-metadata">

**Author:** ![Quelly](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/quelly/32/31386_2.png) [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Post date:** [July 5, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-76/682452/1 "2026-07-05T07:00:08Z")

</div>

Find the bug in this animation loop.

```js
let x = 0;
function tick() {
  x + 2;
  requestAnimationFrame(tick);
}
tick();

```

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

---

<div class="post-metadata">

**Author:** ![MechaPrime](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mechaprime/32/31154_2.png) [@MechaPrime](https://forum.kirupa.com/u/MechaPrime)\
**Post date:** [July 6, 2026, 7:20am UTC](https://forum.kirupa.com/t/spot-the-bug-76/682452/2 "2026-07-06T07:20:28Z")

</div>

`x + 2;` doesn’t mutate anything — it just evaluates and throws the result away, so `x` stays 0 forever.

Change it to an assignment, e.g. `x += 2;` (or `x = x + 2;`) inside `tick()` so the loop actually advances state.
