Tell us what’s happening:
I honestly don’t know what I’m doing wrong. It looks like it’s telling me to update with radio option if something appears less than 3 times, but I believe that’s what I added into the code. Could someone help me with this?
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const getHighestDuplicates = (array) => {
let highestDuplicates = {};
let sum = diceValuesArr.reduce((acc, el) => acc + el, 0)
listOfAllDice.forEach(el => {
if(highestDuplicates.hasOwnProperty(el, textContent)){
highestDuplicates[el.textContent] ++
} else{
highestDuplicates[el.textContent] = 1
}
})
for (let key in highestDuplicates){
if(highestDuplicates[key] >= 3){
updateRadioOption(0, sum)
}
else if (highestDuplicates[key] < 3){
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();
}
});
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7