Tell us what’s happening:
I’m getting an error that my three of a kind portion is not correct. The console does not have any errors. I’ve read many other forum posts about this step, researched documentation, and cannot figure out what’s wrong. Why isn’t my code passing?
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const getHighestDuplicates = (array) => {
const count = array.reduce((acc, curr) => {
acc[curr] = (acc[curr] || 0) + 1;
return acc;
}, {});
const rollScore = array.reduce((a, b) => a + b);
if (count >= 4) {
updateRadioOption(0, rollScore);
updateRadioOption(5, 0);
updateRadioOption(1, rollScore);
return;
} else if (count >= 3) {
updateRadioOption(1, rollScore);
updateRadioOption(5, 0);
return;
} 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(diceValuesArr);
}
});
// User Editable Region
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) 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