Review Algorithmic Thinking by Building a Dice Game - Step 4

Tell us what’s happening:

Not sure what the problem is here.
I can roll the dice 3 times and then an alert shows as instructed and the rolls counter resets to zero.
Is that not what it asks for?

Your code so far

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

/* file: styles.css */

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

rollDiceBtn.addEventListener("click", () => {
  rollDice();
  rolls ++;
  if (rolls > 3){alert("Maximum Rolls Reached - Select a Score"); rolls = 0}

});

// 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 Edg/126.0.0.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 4

The instructions were:

If a user clicks the rollDiceBtn but has already made three rolls, the browser should show an alert() to indicate they must select a score - otherwise, it should roll the dice as it currently does and increment the rolls variable.

Notice how this sentence starts with an if? This is a clue.
Also notice that this sentence contains the word “otherwise”? This is another clue.

Got it. Many thanks.
Is this not just achieving the same thing though?

It was not functionally the same, no.
You were, for eg, trying to increment the rolls each time the button got clicked.
And you were rolling the dice each time as well.