Tell us what’s happening:
I checked, double checked, And checked again, Couldn’t find the problem for the life of me. I’ve been stuck on this for days, Please help.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const scoreOptions = {
"three-of-a-kind": 0,
"four-of-a-kind": 1,
"full-house": 2,
"small-straight": 3,
"large-straight": 4,
"none": 5
};
const getHighestDuplicates = () => {
const count = {};
let diceSum = 0;
for (const number of diceValuesArr) {
count[number] = (count[number] || 0) + 1;
diceSum += number;
}
let numFrequency = 0;
for (const numberFr in count) {
if (count[numberFr] > numFrequency) {
numFrequency = count[numberFr];
}
}
updateRadioOption(scoreOptions["none"], 0);
if (numFrequency >= 4) {
updateRadioOption(scoreOptions["four-of-a-kind"], diceSum);
updateRadioOption(scoreOptions["three-of-a-kind"], diceSum);
} else if (numFrequency >= 3) {
updateRadioOption(scoreOptions["three-of-a-kind"], diceSum);
}
}
rollDiceBtn.addEventListener("click", () => {
if (rolls === 3) {
alert("You have made three rolls this round. Please select a score.");
} else {
rolls++;
rollDice();
getHighestDuplicates();
updateStats();
}
});
// 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/133.0.0.0 Safari/537.36 OPR/118.0.0.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7