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

### Tell us what’s happening:

I think it is working but It has not passed yet. What is wrong?

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

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

const getHighestDuplicates = () => {
const counts = {};
diceValuesArr.forEach((value) => {
counts[value] = (counts[value] || 0) + 1;
})

const values = Object.values(counts);

const threeNumber = values.some((value) => value === 3);
const fourNumber = values.some((value) => value === 4);
const updateScore = diceValuesArr.reduce((a,b) => a+b, 0 );

if(!threeNumber && !fourNumber) {
} else if(threeNumber) {
} else if(fourNumber) {
}

}

// User Editable Region
``````
``````/* file: styles.css */

``````

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

Do you get any error messages or hints?

1 Like

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.
Yes, this is my error message.

The instructions: “… create a `getHighestDuplicates` function which takes an array of numbers. The function will need to count how many times each number is found in the array.”

Where is the required function declared?

1 Like

Do you mean I need to declare the function with parameter? Sorry, I’m confuse.

Well I put the diceValuesArr as parameter but still not pass yet but it changes the error message.
When the array has four of the same number, your `getHighestDuplicates` function should update the `Four of a Kind` radio option with `, score =` and the total sum of the dice.

``````const getHighestDuplicates = (array) => {
const counts = {};
diceValuesArr.forEach((value) => {
counts[value] = (counts[value] || 0) + 1;
})

const values = Object.values(counts);

const threeNumber = values.some((value) => value === 3);
const fourNumber = values.some((value) => value === 4);
const updateScore = diceValuesArr.reduce((a,b) => a+b, 0 );

if(!threeNumber && !fourNumber) {
} else if(threeNumber) {
} else if(fourNumber) {
}

}

if (rolls === 3) {
} else {
rolls++;
rollDice();
getHighestDuplicates(diceValuesArr);

}
### Tell us what's happening:
I think it is working but It has not passed yet. What is wrong?

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

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

const getHighestDuplicates = () => {
const counts = {};
diceValuesArr.forEach((value) => {
counts[value] = (counts[value] || 0) + 1;
})

const values = Object.values(counts);

const threeNumber = values.some((value) => value === 3);
const fourNumber = values.some((value) => value === 4);
const updateScore = diceValuesArr.reduce((a,b) => a+b, 0 );

if(!threeNumber && !fourNumber) {
} else if(threeNumber) {
} else if(fourNumber) {
}

}

// User Editable Region
``````
``````/* file: styles.css */

``````

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`