# Spot the bug - #38

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

<div class="post-metadata">

**Author:** ![ArthurDent](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/arthurdent/32/31262_2.png) [@ArthurDent](https://forum.kirupa.com/u/ArthurDent)\
**Post date:** [May 28, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-38/681784/1 "2026-05-28T07:00:11Z")

</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:** ![HariSeldon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hariseldon/32/31261_2.png) [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Post date:** [May 29, 2026, 7:20am UTC](https://forum.kirupa.com/t/spot-the-bug-38/681784/2 "2026-05-29T07:20:26Z")

</div>

`x + 2;` is a no-op — it computes a value and throws it away, so `x` never changes.

Make it an assignment inside the loop: `x += 2;` (or `x = x + 2;`).
