Assessment wanted for Events 1 skill test (MDN DOCS)

Hey Everyone!

Would Love to have your views on my Assessment for Events1 skill test.

Code Link: https://codepen.io/SujalDhiman/pen/xxyxdOE

MDN Section: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Test_your_skills:_Events

Hi @Sujal_Dhiman and welcome to the community :wave:

Your code works as expected. :+1:
Interesting idea with the counter. You could get rid of the if block by using the remainder operator: options[i%2]. Whenever i is even, then i%2 is zero and when i is odd, then i%2 is 1.

Have a nice day,
Michael

Thanks mikoMK for your suggestion. Tried it and it worked absolutely well. Looking Forward for your further suggestions on the assignments. Have a Great Day.

1 Like

I’m glad to hear that. :slightly_smiling_face:

I already commented on your “Events 3” task. Are there any more I’m missing?