Tell us what’s happening:
i cant seem to understand the problem?? I think the code is right.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
function getHighestDuplicates(){
const count = {};
let totalScore = 0;
diceValuesArr.forEach((number) => {
count[number] = (count[number] || 0) + 1;
totalScore += number
})
const maxNumber = Math.max(...Object.values(count));
console.log(maxNumber)
if(maxNumber >= 4){
updateRadioOption(0, totalScore);
updateRadioOption(1, totalScore);
updateRadioOption(5, 0);
console.log("four-of-kind")
} else if(maxNumber >= 3){
updateRadioOption(0, totalScore);
updateRadioOption(5, 0);
console.log("three-of-kind")
} else{
updateRadioOption(5, 0);
console.log("none");
}
}
rollDiceBtn.addEventListener("click", () => {
if (rolls === 3) {
alert("You have made three rolls this round. Please select a score.");
} else {
rolls++;
rollDice();
updateStats();
getHighestDuplicates()
}
});
// 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/131.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7