Tell us what’s happening:
My codes are working but they are keep telling me this
‘When the array has three of the same number, your getHighestDuplicates function should update the Three of a Kind radio option with , score = and the total sum of the dice.’
can anyone help please???
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
function getHighestDuplicates() {
const count = {};
for (let i = 0; i < diceValuesArr.length; i++) {
let ele = diceValuesArr[i];
if (count[ele]) {
count[ele] += 1;
} else {
count[ele] = 1;
}
}
const sumOfArr = diceValuesArr.reduce((acc, cur) => acc + cur, 0);
if (Math.max(...Object.values(count)) >= 4) {
updateRadioOption(1 , sumOfArr)
} else if (Math.max(...Object.values(count)) >= 3) {
updateRadioOption(0 , sumOfArr)
} 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
/* 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/127.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7