Tell us what’s happening:
Working in local environment but not passing tests. Also the textContent is not updating in the freeCodeCamp preview browser, where as it is in my local environment
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const getHighestDuplicates = () => {
numObj = {};
sum = 0;
for (let i = 0; i < diceValuesArr.length; i++) {
const value = diceValuesArr[i];
if (numObj[value] === undefined) {
numObj[value] = 1;
} else {
numObj[value] += 1;
}
sum += value;
}
// flag for match
let found = false;
// four of a kind
for (const key in numObj) {
if (numObj[key] === 4) {
updateRadioOption(1, sum);
found = true;
break;
}
}
// three of a kind
if (!found) {
for (const key in numObj) {
if (numObj[key] === 3) {
updateRadioOption(0, sum);
found = true;
break;
}
}
}
// Others
if (!found) {
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/126.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7