Review Algorithmic Thinking by Building a Dice Game - Step 3

Tell us what’s happening:

I don’t know what I am doing wrong. my code is working fine and is doing the things ask yet it doesn’t accept it. I don’t know anymore which part I am missing, can someone help point out what is missing?

Your code so far

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

/* file: styles.css */

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


const randomNumbers = () => {
  for (let i = 0; i < 5; i++){
    const randomNumber = Math.floor(Math.random() * 6) +1
    diceValuesArr.push(randomNumber)
  }

  diceValuesArr.sort((a,b) => a-b).slice();

  listOfAllDice.forEach((die,index) => {
    die.textContent = diceValuesArr[index]
    });
    console.log(diceValuesArr)
  diceValuesArr = []
}
  
rollDiceBtn.addEventListener("click", randomNumbers)

// 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/123.0.0.0 Safari/537.36 OPR/109.0.0.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 3

Hey, diceValuesArr = [] needs to go on top just below the start of your function. Also I dont think you need this line of code here diceValuesArr.sort((a,b) => a-b).slice();

1 Like