# Review Algorithmic Thinking by Building a Dice Game - Step 7

### Tell us what’s happening:

My code is not working no errors in the console and the output is as expected

### Your code so far

``````<!-- file: index.html -->

``````
``````/* file: styles.css */

``````
``````/* file: script.js */
// User Editable Region

const getHighestDuplicates = (arr) => {
const hash = {};

arr.forEach(num => {
hash[num] = (hash[num] || 0) + 1;
})
let max = 0;
for(let i = 0; i < Object.values(hash).length; i++) {
if(Object.values(hash)[i] > max) {
max = Object.values(hash)[i];
}
}
if(max >= 4) {
updateRadioOption(1, diceValuesArr.reduce((acc, cur) => {
return acc + cur;
}, 0));
}
if(max >= 3) {
updateRadioOption(0, diceValuesArr.reduce((acc, cur) => {
return acc + cur;
}, 0));
}
}

rollDiceBtn.addEventListener("click", () => {
if (rolls === 3) {
alert("You have made three rolls this round. Please select a score.");
} else {
rolls++;
rollDice();
getHighestDuplicates(diceValuesArr)
}
});

// 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`

### Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 7

Hello, try resetting the challenge.

hi there!

you are hard coding the program. the `Object.values()` not be assigned every time when it needed. store it in a variable and assign that instead.

also store the `array.reduce()` method in a variable to avoid hard coding.