Tell us what’s happening:
I have converted the string to a number and added it to the score, updating the necessary values. Where am I going wrong?
QUESTION:
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.
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const updateScore = (selectedValue, acheived) => {
score += parseInt(selectedValue);
totalScore.textContent = score;
scoreHistory.innerHTML = `<li>${acheived} : ${selectedValue}</li>`
}
// User Editable Region
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 9