Review Algorithmic Thinking by Building a Dice Game - Step 9

I’m stuck in the step #9 of Review Algorithmic thinking by Building a dice game. This is my code so far
const updateScore = (selectedValue, achieved) => {
totalScore += parseInt(selectedValue);
totalScore.textContent = totalScore;
scoreHistory.innerHTML += <li>${achieved}: ${selectedValue}</li>;
};
but it keeps telling me that I have an error cause “Your updateScore function should convert string value to integer and add the value to the total score.” I tried everything. Please help me

Your code so far

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

const updateScore = (selectedValue, achieved) => {
  totalScore += parseInt(selectedValue);
  totalScore.textContent = totalScore;
  scoreHistory.innerHTML += `<li>${achieved}: ${selectedValue}</li>`;
};

// 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 9

the correct integer variable you need for this is score not totalScore (look at all the variables you created in the top of the program. You will not see an integer variable called totalScore, rather there is one called score that you should be using.)

Edit: also this line has to be fixed also to use variables that are defined and not variables that do not exist.

And finally this line is missing one space to the left of the colon:

It is also possible you have a cached version of this step because it used to have a totalScore variable. Clear your cache and do a hard refresh Shift + F5.


Just to be clear, totalScore was still an element and not something you could use the way you are for the adding to the total score.