Tell us what’s happening:
i’ve try to play the game and it seem it works, but some how my code did’t pass can anyone tell me whats wrong?
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const getHighestDuplicates = () => {
const counts = {};
const sum = diceValuesArr.reduce((acc, el) => acc + el, 0)
diceValuesArr.forEach((num) => {
counts[num] = (counts[num] || 0) + 1;
})
const maxCount = Math.max(...Object.values(counts));
updateRadioOption(5, 0);
if (maxCount >= 4) {
updateRadioOption(1, sum);
updateRadioOption(0, sum);
} else if (maxCount >= 3) {
updateRadioOption(0, sum);
};
console.log(counts)
console.log(sum)
console.log(maxCount)
}
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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7