Tell us what’s happening:
i am having a problem when it comes to putting a score and also understanding
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
// the problems lies below
function getHighestDuplicates (diceValuesArr) {
let score = 0;
let counts = {};
diceValuesArr.forEach(num => {
counts[num] = (counts[num] || 0) + 1;
score+=num;
});
for (let num in counts) {
if (counts[num] >= 4) {
updateRadioOption(1, score);
} else if (counts[num] >= 3) {
updateRadioOption(0, score);
}else{
updateRadioOption(0,score);
}
}
getHighestDuplicates();
}
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/137.0.0.0 Safari/537.36 Edg/137.0.0.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7