Tell us what’s happening:
i know that I’m making a mistake with the if statement but i dont know how to correct it please help
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const getHighestDuplicates = (diceValuesArr) => {
const counts = {};
diceValuesArr.forEach(value => counts[value] ? counts[value] + 1 : 1);
let totalScore = diceValuesArr.reduce((a, b) => a + b);
for (const value in counts) {
if (counts[value] >= 4) {
updateRadioOption(0, `score = ${score}`)
} else if (counts[value] >= 3) {
updateRadioOption(1, `score = ${score}`)
}
}
}
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
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7