Review Algorithmic Thinking by Building a Dice Game - Step 1

Tell us what’s happening:

The hint box seems to accept most of my variable declarations, but not the #total-score one being assigned to totalScoreText using the querySelector method.

I’ve tried using getElementById and querySelectorAll, and reformat the declaration by using “#total-score span”, and nothing seems to work. Looking at previous posts on the forum, it seems people used either approach similarly to what I’m using but it worked for them. I’m at a loss on what else to try.

That’s a very long step with many things that can go wrong, it could be easier to work on it if it was broken down into smaller steps? Just a thought here

Your code so far

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

/* file: styles.css */

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

const listOfAllDice = document.querySelectorAll(".die");
const scoreInputs = document.querySelectorAll("#score-options input");
const scoreSpans = document.querySelectorAll("#score-options span");
const currentRound = document.querySelector("#current-round");
const currentRoundRolls = document.querySelector("#current-round-rolls");
const totalScoreText = document.querySelector("#total-score");
const scoreHistory = document.querySelector("#score-history");
const rollDiceBtn = document.querySelector("#roll-dice-btn button");
const keepScoreBtn = document.querySelector("#keep-score-btn button");
const rulesBtn = document.querySelector("#rules-btn button");
const rulesContainer = document.querySelectorAll(".rules-container");

let isModalShowing = false;
const diceValuesArr = [];
let rolls = 0;
let score = 0;
let total = 0;
let round = 1;

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 1

there’s a known bug with that hint:

Ok, changing the variable name to “totalScore” (and adjusting other things that were wrong with my code) did the trick. Thank you!

2 Likes