DEV Community

Jennifer Tieu
Jennifer Tieu

Posted on

Self-Taught Developer Journal, Day 52: TOP Building Rock Paper Scissors UI cont.

Today I started writing the JavaScript for my Rock Paper Scissors UI.

I began with creating a named function to pass to the button addEventListener. The function will take the event as an argument.
For this function, I decided to re-use my game function I created in the earlier assignment.

Old game function

As I testing the button events, I was having a hard time getting the correct button value to console log. I ended up down the rabbit hole of trying to Google to see what I was doing wrong.

event target

I found out it was I should have been using the event target property. Specifically, I needed to do event.target.value, but I was trying to do event.value. It made realize I am definitely not familiar with the Event object. Even though I was looking at the Event object in console too.

I'm hoping to read up more on it, but glad I was able to get the correct output.

For future reference to myself:
https://www.w3schools.com/jsref/obj_event.asp
https://www.w3schools.com/jsref/dom_obj_event.asp

Resources

The Odin Project
Revisiting Rock Paper Scissors

Discussion (0)