Tell us what’s happening:
My code literally works and yet the program doesn’t accept it so there must be something that is breaking my logic, but I can’t put my finger on what it could be
Please help me and don’t give me vague answers \n
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const getHighestDuplicates = () => {
const counts = {}
diceValuesArr.forEach((roll) => {
counts[roll] = (counts[roll] || 0) + 1
})
const sum = (array) => array.reduce((acc, el) => acc + el, 0);
for (let i = 0; i < scoreInputs.length; i++) {
scoreInputs[i].disabled = true;
scoreSpans[i].textContent = ""}
if (Object.values(counts).includes(3)) {
updateRadioOption(0, sum(diceValuesArr))
} else if (Object.values(counts).includes(4)) {
updateRadioOption(0, sum(diceValuesArr))
updateRadioOption(1, sum(diceValuesArr))
} else {
updateRadioOption(5, 0)
}}
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 OPR/113.0.0.0
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 166