Review Algorithmic Thinking by Building a Dice Game - Step 4

Tell us what’s happening:

My code seems to do what is asked. I’m not sure why it won’t pass.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

rollDiceBtn.addEventListener("click", () => {
  rollDice();
  if(rolls === 3){alert("You have rolled 3 times. You must select a score.")}
  else{rolls++;}
});

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 4

Check your logic. Are you following this instruction well?

otherwise, it should roll the dice as it currently does and increment the rolls variable.

Hint: when they say otherwise, that means your else statement should do whatever they said there. (Multiple things)

I figured it out. I did increment my rolls variable but I did not call my rollDice() function at the end of my else statement.

1 Like