Assessment wanted for -> Events

Here’s the assessment, my code and a live example.

Any advice on how I could improve my code is always welcome. :smiley:

Hello @salvadorperezm

you doing great well done just some notice here

  1. for task 2 you do not need to edit the html only the js
    and the ball should move just by pressing the wasd so you can add the event handler to the canvas or even to the document if you like

  2. for task 3 you do not need to add event listener to each button you can add it to the div button-bar and get the target element and if it match any one of those button then apply the right color

when you click on click on one of the button it also fire even to the parent of the button

check those both links to know hoe the event propagate
https://www.quirksmode.org/js/events_order.html
https://www.w3.org/TR/DOM-Level-3-Events/#event-flow

hope that help and have a nice day :slight_smile:

2 Likes

Thank you very much @justsomeone, Those links you provided were extremely helpful!

I’ve already updated my code, you can check it out right here. :smiley:

2 Likes

you very welcome and well done :100:

2 Likes