Tell us what’s happening:
i am getting stuck here on this step . i am sure i did the right steps and my code is correct too but it still says that my code is wrong plus i am confused by the ", score = 0 " how is this possible it throws an error if i use
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
rollDiceBtn.addEventListener("click", () => {
if (rolls === 3) {
alert("You have made three rolls this round. Please select a score.");
} else {
rolls++;
rollDice();
updateStats();
getHighestDuplicates(diceValues);
}
});
function getHighestDuplicates(diceValuesArr) {
let counts = {};
let highestCount = 0;
const totalScore = diceValuesArr.reduce((sum, value) => sum + value, 0);
diceValuesArr.forEach((value) => {
counts[value] = (counts[value] || 0) + 1;
highestCount = Math.max(highestCount, counts[value]);
});
// Less than three of a kind
if (highestCount < 3) {
updateRadioOption( , score=0); // final radio option
// i am stuck here
}
// Three of a kind (only)
if (highestCount === 3) {
updateRadioOption(0, totalScore); // Three of a Kind
}
// Four of a kind
if (highestCount >= 4) {
updateRadioOption(1, totalScore); // Four of a Kind
updateRadioOption(0, totalScore); // Three of a Kind
}
}
// 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/143.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7
