Tell us what’s happening:
This is the problem am having currently
// running tests
4. When the array has three of the same number, your getHighestDuplicates function should update the Three of a Kind radio option with , score = and the total sum of the dice.
I think i have tired my best to sort the issue but i guess it isnt enough
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const getHighestDuplicates=(numbers)=>{
const counts={};
for(let number of numbers){
counts[number]=(counts[number]||0) +1;
}
let highestCount=0
for(let count in counts){
if(counts[count] > highestCount){
highestCount =counts[count]
}
}
const sum = numbers.reduce((a, b) => a + b, 0);
if (highestCount >= 3) {
updateRadioOption(2, sum); // Three of a Kind
} else {
updateRadioOption(5, 0); // Final
}
}
rollDiceBtn.addEventListener("click", () => {
if (rolls === 3) {
alert("You have made three rolls this round. Please select a score.");
} else {
rolls++;
rollDice();
updateStats();
}
});
// 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/131.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7