Tell us what’s happening:
Hi. I’ve tested/modified my code a dozen of times, but none of the variants pass, even though when I test it, it works.
Possible cause:
After 3 or 4 same numbers appear and you click the button again, the checked inputs don’t become unchecked, but I think they don’t need to get unchecked for the next roll on this step?
I really don’t know what the problem is.
Thank you for your time.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const getHighestDuplicates = array => {
const count = {}
let maxNum = 0;
const sum = Array.from(listOfAllDice).reduce((total, dice) => total + Number(dice.textContent), 0);
array.forEach(dice => {
count[dice] = count[dice] ? count[dice] + 1 : 1
})
for (let i in count) {
if (count[i] > maxNum) {
maxNum = count[i]
}
}
if (maxNum >= 4) {
updateRadioOption(1, sum)
}
if (maxNum >= 3) {
updateRadioOption(0, sum)
}
updateRadioOption(5, 0)
}
rollDiceBtn.addEventListener("click", () => {
if (rolls === 3) {
alert("You have made three rolls this round. Please select a score.");
} else {
rolls++;
rollDice();
updateStats();
getHighestDuplicates(diceValuesArr);
}
});
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7