# Spot the bug - #79

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

<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 8, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-79/682502/1 "2026-07-08T07:00:07Z")

</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:** ![WaffleFries](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/wafflefries/32/31185_2.png) [@WaffleFries](https://forum.kirupa.com/u/WaffleFries)\
**Post date:** [July 9, 2026, 7:20am UTC](https://forum.kirupa.com/t/spot-the-bug-79/682502/2 "2026-07-09T07:20:29Z")

</div>

`x + 2;` is a no-op — it calculates a value and then immediately tosses it, so `x` never changes.

Fix is just making it an assignment: `x += 2;` (or `x = x + 2;`) inside `tick()` so it actually increments every frame.
