Review Algorithmic Thinking by Building a Dice Game - Step 1

Tell us what’s happening:

Hey fcc. Please assist me. The error message says “You should assign your .die elements to listOfAllDice” and I found the die class elements already assigned in my code but the code is still not passing.

Your code so far

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

/* file: styles.css */

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


let isModalShowing = new Boolean();
const diceValuesArr = [];
const rolls 
const score 
const total 
const round 

rulesBtn.addEventListener("toggle", function() {
  if (rulesContainer.classList.contains("rules-btn")) {
      rulesContainer.classList.remove("rules-btn");
      let isModalShowing = false;
  }else{
    rulesContainer.classList.add("rules-btn");
    let isModalShowing = true;
  }
})


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

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 1

is this all your code? I’m not sure I see anything that gets all the .die elements above.
also did you notice that you declared your variables as all const for rolls, score, total and round even though the exercise said:

Think about what the starting value of each of these variables should be. All of these variables should be able to be reassigned.

const listOfAllDice = document.querySelectorAll(“.die”);

const scoreInputs = document.querySelectorAll(“#score-options input”);

const scoreSpans = document.querySelectorAll(“#score-options span”);

const currentRound = document.getElementById(“current-round”);

const currentRoundRolls = document.getElementById(“current-round-rolls”);

const totalScore = document.getElementById(“total-score”);

const scoreHistory = document.getElementById(“score-history”);

const rollDiceBtn = document.getElementById(“roll-dice-btn”);

const keepScoreBtn = document.getElementById(“keep-score-btn”);

const rulesContainer = document.querySelector(“.rules-container”);

const rulesBtn = document.getElementById(“rules-btn”);
I found these variables already assigned in the code

you can’t have const variables without a value, it breaks the code and nothing works

1 Like

i figured it out. Thank you.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.