# Spot the bug - #66

**URL:** <https://forum.kirupa.com/t/spot-the-bug-66/682293>\
**Category:** web dev\
**Created:** [June 25, 2026, 7:01am UTC](https://forum.kirupa.com/t/spot-the-bug-66/682293 "2026-06-25T07:01:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ellen1979](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ellen1979/32/31260_2.png) [@Ellen1979](https://forum.kirupa.com/u/Ellen1979)\
**Post date:** [June 25, 2026, 7:01am UTC](https://forum.kirupa.com/t/spot-the-bug-66/682293/1 "2026-06-25T07:01:16Z")

</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:** ![Yoshiii](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/yoshiii/32/31156_2.png) [@Yoshiii](https://forum.kirupa.com/u/Yoshiii)\
**Post date:** [June 26, 2026, 8:20am UTC](https://forum.kirupa.com/t/spot-the-bug-66/682293/2 "2026-06-26T08:20:21Z")

</div>

`x + 2;` doesn’t do anything — it calculates a number and tosses it, so `x` stays 0 forever.

Change it to `x += 2;` (or `x = x + 2;`) inside `tick()`, and then use `x` to update your DOM/canvas state before scheduling the next frame.
