Rock, paper, scissors. (Hit a wall, need some help!)

Hey Everyone,

I am very new to JavaScript and have hit a serious wall on a rock paper scissors game I am working on. You can find my current code in the link below. I am trying to figure out how to update the variable that stores the players choice after the player clicks one of the 3 choice buttons.

I’d greatly appreciate any and all help. Thank you all so much, this community has been a huge help on this journey!

-Buddha Blake

What exactly is it you want to save, the string value?

function buttonClick(event){
  player.currentChoice =;

Currently the choices are contained in an array and my conditional statements are referencing the position in the array and not actually referencing the words (lapis, papyrus, scalpellus) themselves.

if(player.currentChoice === choices[1])

What I need to happen is when the user clicks one of the buttons, the player.currentChoice variable is updated to reflect the choice, but the value needs to be in the "choices format.

Does that make sense? I am still learning the lingo. Thanks for your help.

-Buddha Blake

It does that already.

But your code only runs one time, that is when the page loads. You need to wrap the code that needs to run again in a function you can call.

Wrap the CPU choice code and the game logic/DOM update code in functions you can call. Then call them inside the button click handler function.

function buttonClick(event) {
  player.currentChoice =;