4

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

 2 years ago
source link: https://dev.to/jennifer_tieu/self-taught-developer-journal-day-52-top-building-rock-paper-scissors-ui-cont-261n
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Self-Taught Developer Journal (52 Part Series)

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.

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.

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK