Tell us what’s happening:
I am just stuck, i can see the code working and updating the preview correctly, or at least i believe correctly. i have tried logging everything to the console to see what is happening, and i have looked through all the errors and just cant id what im doing wrong.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
function getHighestDuplicates (numArr) {
const counts = {};
let rollScore = numArr.reduce((partialSum, a) => partialSum + a, 0);
for (const num of numArr) {
counts[num] = counts[num] ? counts[num] + 1 : 1;
};
for (let count in counts) {
if(counts[count] >= 4) {
updateRadioOption(1, rollScore);
updateRadioOption(0, rollScore);
return;
} else if(counts[count] === 3) {
updateRadioOption(0, rollScore);
return;
} else{
updateRadioOption(5, 0);
return;
};
};
};
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
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7