Tell us what’s happening:
This is the question .please help me out…I have been trying to figure out where my error is coming from
When the user clicks on the Roll the dice button, five random die numbers should be generated and displayed on the screen.
Build out the logic such that clicking on the rollDiceBtn generates five random numbers between 1 and 6 inclusive, sets the diceValuesArr to contain only those five numbers, and displays the numbers in order in the listOfAllDice elements.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
function dice (){
for(let i=0; i<5; i++){
diceValuesArr=[]
const random=Math.floor(Math.random()*6)+ 1
diceValuesArr.push(random);
listOfAllDice.textContent=diceValuesArr
}
return listOfAllDice
}
console.log(dice())
rollDiceBtn.addEvenlistener("click", dice())
// 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/131.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 3