Review Algorithmic Thinking by Building a Dice Game - Step 5

Tell us what’s happening:

Everything updates as should. I can’t seem to find the error

Your code so far

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

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

const updateStats = () => {
    rolls += 1;
  currentRoundRolls.textContent = rolls;
  if (rolls === 3) {
    round += 1;
    currentRound.textContent = round;
  }
} 

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

// User Editable Region
/* file: styles.css */

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 5

That code can’t run, so how do you know everything works?

when i click the roll the dice button. all values update
but when i submit it keeps throwing me an error

and there is an update stats call in the else block that was omitted

you have too much code and too many assumptions.
Try to re-read the instructions again and limit your assumptions to exactly what is being said and no more.
For eg. Where in the instructions does it say that updateStats should do anything other than simply update the stats? (where does it say that you should increment the values for example or check them for anything)

2 Likes

thank you. i will make sure to do next do that in future

1 Like