r/learnwebdev • • Jul 31 '20

Need help with my code?

I'm making a rock paper scissors game but I'm currently stuck on trying to get the users input to compare with the computers input here is a link to my git hub.

https://github.com/rsteward117/randy-s-rock-paper-scissors-game

3 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/boomer1204 Jul 31 '20

So i'm still 100% sure exactly what part of the code you are asking about (if you even are).

The first thing I notice is on line 18 you have incorrect syntax

` <button id-"rock">Pick Rock</button>`

so I would start by fixing that

Second when you are looping over the buttons adding the event listener you are calling playground but playground has no idea what button was pressed. You will either want to pass in what button was selected or you can use the extra parameter of index with `forEach` to pass that in and find out using that forEach((button, index) =>