Review Algorithmic Thinking by Building a Dice Game - Step 9

Tell us what’s happening:

i don’t understand why the console is saying “Your updateScore function should update the text of the totalScoreElement element”

i even changed it to innerText but it still doesn’t work

Your code so far

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

/* file: styles.css */

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

const updateScore = (value, id) => {
  const selectedValue = parseInt(value, 10);
  score += selectedValue;

  
  totalScoreElement.textContent = `Total Score: ${score}`; 

  
  const newHistoryItem = document.createElement('li');
  newHistoryItem.textContent = `${id} : ${selectedValue}`;
  scoreHistory.appendChild(newHistoryItem);

  
  rolls = 0;
  round++;
  updateStats();
  resetRadioOptions();
};

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

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 9

@femto-dude It looks like score and scoreHistory are not defined.

Hey @femto-dude,

Welcome to the forum. Take a look at the following code. You have some extra stuff there. Did the instructions ask you to add it like this?

totalScoreElement.textContent = Total Score: ${score};

rolls = 0;
round++;
updateStats();
resetRadioOptions();

The full JS code was not included in the original post, but if you go to the link for this challenge, you’ll see that both score and scoreHistory were declared as constants in index.js.

I’ve removed it and even updated parts of the code but it’s still giving me the same result

Edit: I’ve done it already, I just removed the Total score : from it and just left the interpolation

Good job, @femto-dude!