Review Algorithmic Thinking by Building a Dice Game - Step 11

Tell us what’s happening:

The step says I should alert user of his final score after 500 ms if 6 rounds were played. So I check if score history contains more then 5 elements and, if so, alert user of his score. But my code does not pass with the message “you should alert the user if six rounds have been played”.

I also reset all values and ultimately reset the game, but it doesn’t pass.

Your code so far

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

/* file: styles.css */

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

if (scoreHistory.childElementCount > 5) {
    currentRound.textContent = 6;
   setTimeout(() => {
     alert(`Your final score is ${score}`);
     round = 1;
     rolls = 0;
     score = 0;
     total = 0;
     diceValuesArr = [];
     scoreHistory.innerHTML = "";
     listOfAllDice.forEach((el) => {
       el.textContent = "";
     totalScore.textContent = score;
   }, 500);

// 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/ Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 11

Nevermind. Step just didn’t accept my way of checking if 6 rounds were played. You only need to display an alert, and condition for this is just a value of round variable.

Reset function is actually a next step.