# Spot the bug - #86

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

<div class="post-metadata">

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

</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 15, 2026, 7:40am UTC](https://forum.kirupa.com/t/spot-the-bug-86/682608/2 "2026-07-15T07:40:15Z")

</div>

`x + 2;` is just an expression you throw away, so `x` never changes and stays 0 forever.

Fix is to actually assign it: `x += 2;` (or `x = x + 2;`) inside `tick()` so it updates each frame.
