I can’t figure out what is wrong with my code.
The hint says your updateScore function should update the text of the totalScoreElement… But I’ve done that?
the hint within the console reads:
When updateScore(10, “hi”) is called, your new list element should have the text hi : 10
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
function updateScore(value, id) {
score += parseInt(value);
// Update the total score displayed on the page
totalScoreElement.textContent = `Total Score: ${score}`;
// Add the selection to the score history
const li = document.createElement('li');
li.textContent = `${id} : ${score}`;
scoreHistory.appendChild(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/130.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 9
hello, thanks for the response.
i did that but the code has still not passed,
the hint msg im getting now is:
When updateScore(10, "hi") is called, your new list element should have the text hi : 10 .
I realize i forgot to add the instructions for this step:
When you roll the dice and make a selection, you are not able to keep the score you selected and move onto the next round.
Create an updateScore function to add this functionality. Your function will need two parameters for the user selected score option. The first parameter will be passed the value of the radio button, remember this is a string, and the second parameter will be passed the id value of the radio button, which is the type of score they achieved.
The function will need to add the user selected value to the score, update the total score text on the page, and add a new li element to the score history ul element, using the format ${achieved} : ${selectedValue} for the li element content.