Assessment wanted for Event 2 skill test

I am having little trouble understanding why the circle is not moving. Below link has the code:

Hi @vkhtgpt5 and welcome to the community :wave:

Sorry for the looong delay.

You don’t actually update the x or y value in your cases. Setting KeyD etc. doesn’t do anything. Also keyCode is deprecated. It’s better to either use KeyboardEvent.code or KeyboardEvent.key.

A working solution could be:

window.addEventListener('keydown', e => {
  switch(e.key) {
    case 'a':
      x -= 2;
      break;
    case 'd':
      x += 2;
      break;
    case 'w':
      y -= 2;
      break;
    case 's':
      y += 2;
      break;
  }

  drawCircle(x, y, size);
});

I hope that helps,
Michael