Review Algorithmic Thinking by Building a Dice Game - Step 4

Tell us what’s happening:

i am making an obvious mistake here …please point it out

Your code so far

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

rollDiceBtn.addEventListener("click", () => {
  rollDice();
  if (rolls === 3){
    alert("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/126.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 4

the alert pops up after three times button click but the step does not pass

Hi @edgyruchir

The logic for your button click is:

1 . roll the dice
2a. if the number of rolls is equal to three, display an alert
2b. otherwise increment the number of rolls.

Happy coding

1 Like

thank you @Teller …i found the solution on another post it was the placement of roll dice code that was the problem it was supposed to be in the else statement

2 Likes