Tell us what’s happening:
some how im missing my getHighestDuplicates function can someone tell me what im not doing correctly that my getHighDuplicates function isnt showing up as a function
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const getHighestDuplicates = array => {
let duplicates = {};
array.forEach(number => {
duplicates[number] = (duplicates[number] || 0) + 1;
});
console.log(duplicates)
let maxCnt = 0;
let maxDupliates
let sum = array.reduce((sum,value) => sum + value, 0)
for (const [duplicates, cnt] of Object.entries(duplicates)) {
if (cnt > maxCnt) {
maxCnt = cnt;
maxDuplicates = duplicates;
}
}
if (maxCnt > 3) {
updateRadioOption(1, sum)
}
if (maxCnt > 2) {
updateRadioOption(0, sum)
}
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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 7