Tell us what’s happening:
I am not sure why the code doesn’t pass. i think its the last else statement but i cant tell how. Please assist.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const getHighestDuplicates=(arr)=>{
const countNum = {};
const summ = arr.reduce((acc, num)=>acc+num, 0)
let hasThree = false;
let hasFour = false;
for(let num in arr){
countNum[num] = (countNum[num]||0) + 1;
}
for(let num in countNum){
if(countNum[num] >= 4){
updateRadioOption(1,summ)
updateRadioOption(0,summ)
}
else if(countNum[num] === 3){
updateRadioOption(0,summ)
}else{
updateRadioOption(5,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
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7