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;
resetRadioOptions();
score = 0;
total = 0;
diceValuesArr = [];
scoreHistory.innerHTML = "";
listOfAllDice.forEach((el) => {
el.textContent = "";
});
totalScore.textContent = score;
updateStats();
return
}, 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/126.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 11