Review Algorithmic Thinking by Building a Dice Game - Step 7

Tell us what’s happening:

help to solve this lesson its the dice game lesson in javascript lesson no 7

Your code so far

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

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

const getHighestDuplicates = (array) => {
  const count = array.reduce((acc, curr) => {
    acc[curr] = (acc[curr] || 0) + 1;
  return acc;
  }, {});
  
  
  const rollScore = array.reduce((a, b) => a + b);
  
  if (count >= 4) {
    updateRadioOption(0, rollScore);
    updateRadioOption(5, 0);
    updateRadioOption(1, rollScore);
    return;
  } else if (count >= 3) {
    updateRadioOption(1, rollScore);
    updateRadioOption(5, 0);
    return;
  } 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();
    
  }
});

// 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/134.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 7

Doesn’t look like this was done.

Make sure to call your getHighestDuplicates when the dice are rolled.

Also, your new function is not doing what was asked:

The function will need to count how many times each number is found in the array.

what issues are you having? what doubts? what did you try? what are you stuck on?

i dont understand where i wrong in this lesson , i try several times to pass this lesson but not passed , its dice game lesson in javascript lesson no 7

what do you see in the console?

// running tests 2. When the array has less than three of the same number, your

getHighestDuplicates

function should update the final radio option with

, score = 0

. 3. When the array has less than three of the same number, your

getHighestDuplicates

function should not update the first nor the second radio options. 4. 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. 5. When the array has three of the same number, your

getHighestDuplicates

function should not update the

Four of a Kind

radio option. 6. 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. 7. When the array has four of the same number, your

getHighestDuplicates

function should also update the

Three of a Kind

radio option with

, score = 

and the total sum of the dice. 8. You should call your

getHighestDuplicates

function when the dice are rolled.

and below that? don’t you see anything else?

[ReferenceError: updateRadioOptions is not defined]

are you sure it’s that? because I see [ReferenceError: updateRadio0ptions is not defined], which is different from updateRadioOptions

yes we got the same error in console

if we are you copied the wrong one, I see [ReferenceError: updateRadio0ptions is not defined]
where 0ptions is written with the number 0

to add, in the editor, I see one of the times updateRadioOptions is called that has three dots below
image

do you see it?

no sir i don’t get it but thanks sir for your help i try to figure it

please don’t call me “sir”

One of your function calls for updateRadioOptions is written with a 0 (number zero)instead of with anO` (letter O)
you need to fix that

Okay.
i tried it what you said
but it not worked in my side , i think i need to reset this and do again

Here’s your error. Options should not be plural.

ok i’ll try what you suggest

oh, you are right, there isn’t an issue with O and 0, what a brain fart

No worries. We all have those moments.

Just open one thread per step please. I’ve merged your threads together here.