Tell us what’s happening:
failing 2, 4, and 7th tests, not sure what I’m doing wrong here
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const sumDice = diceValuesArr.reduce((acc, curr) => acc + curr, 0)
const getHighestDuplicates = (numbers, sumDice) => {
const counts = {}
for (let num of numbers){
if (counts[num]){
counts[num]++
} else {
counts[num] = 1
}
}
for (let num of numbers){
if (counts[num] < 3){
scoreSpans[5].textContent = ", score = 0";
} else if (counts[num] === 3){
scoreSpans[0].textContent = `, score = ${sumDice}`;
} else if (counts[num] === 4){
scoreSpans[1].textContent = `, score = ${sumDice}`;
}
}
}
rollDiceBtn.addEventListener("click", () => {
if (rolls === 3) {
alert("You have made three rolls this round. Please select a score.");
} else {
rolls++;
rollDice();
updateStats();
updateRadioOption()
}
});
// User Editable Region
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7