Assessment wanted for Events 1 skill test. (Tasks 1-3)

Assessment wanted for Events 1 skill test. (Tasks 1-3)

Link to task: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Test_your_skills:_Events#events_1

Links to my code:
Task-1: https://jsfiddle.net/EiNzp/6sdyhjzc/
Task-2: https://jsfiddle.net/EiNzp/6kgbpjxy/
Task-3: https://jsfiddle.net/EiNzp/nbqza0hv/

Thanks :wink:

Great work, @EiN

All tasks work as requested. I have just some small improvements/simplifications:

  • Task 1: Basing the condition on the button text feels a bit inflexible. I recommend using the class (and also change it accordingly).
  • Task 2: Good idea to also test for the uppercase letters. You could use a switch statement instead of the nested if...else. Another possible simplification would be to call drawCircle after the statement and only change the x/y value inside.
  • Task 3: You could replace event.currentTarget with just buttonBar.

Michael

1 Like

Thank you. Here is my corrected code:
Task-1: https://jsfiddle.net/EiNzp/5hL8ngdk/1/
Task-2: https://jsfiddle.net/EiNzp/y15bqrjc/2/
Task-3: https://jsfiddle.net/EiNzp/3m8x1pdz/2/

Cool improvements :+1:

Especially with the fall-throughs in task 2 the code looks much cleaner.

1 Like