Review Algorithmic Thinking by Building a Dice Game - Step 5

Tell us what’s happening:

What is wrong with code … run function updateStats() is okay ?? can help me.

Your code so far

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

/* file: styles.css */

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

function updateStats() {
  rolls += 1;
  rollsElement.textContent = rolls;
  if (rolls === 3) {
    roundElement.textContent = round;
    round += 1;
  };
};

rollDiceBtn.addEventListener("click", () => {
  if (rolls === 3) {
    alert("You have made three rolls this round. Please select a score.");
  } else {
    updateStats();
    rollDice();
  }
});

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) 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 5

this never happen, as the function is called only when rolls is not 3

the function should only update the text of the elements, not the numeric values of rolls and rounds

1 Like

okay … I passed … tks.