Tell us what’s happening:
I have gone through a lot of people submission trying to figure out what I am doing wrong but I am not sure
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const getHighestDuplicates = () => {
const countMap = diceValuesArr.reduce((map, val) => {
map[val] = (map[val] || 0) + 1;
return map;
}, {});
const counts = Object.values(countMap)
const totalSum = diceValuesArr.reduce((a, b) => a + b, 0);
const hasFourOfAKind = counts.some(count => count >= 4);
const hasThreeOfAKind = counts.some(count => count >= 3);
if (hasFourOfAKind) {
updateRadioOption(1, totalSum);
} else if (hasThreeOfAKind) {
updateRadioOption(0, totalSum);
} else {
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();
}
});
// User Editable Region
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7