Tell us what’s happening:
I believe I meet all the criteria for passing the test but continue to get the message "Your updateScore function should convert string value to integer and add value to total score. I even added an unecessary var called “totalScore” just to see if that would work. No dice…forgive the pun..could’nt resist. 
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const updateScore = (selectedValue, achieved) => {
const opt = document.querySelector('input[name="score-options"]:checked');
achieved = opt.id;
console.log(achieved);
selectedValue = opt.value;
console.log(selectedValue);
const totalScore = score += parseInt(selectedValue);
totalScoreElement.innerText = totalScore;
scoreHistory.innerHTML += `<li>${achieved} : ${selectedValue}</li>`;
};
keepScoreBtn.addEventListener("click", updateScore);
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 9
Welcome to the forum 
Shouldn’t add things that are not in the instructions. How did it look before you added this?
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.
These parameters value
and id
will already be passed to your function to use. You do not need to obtain those values in the function. The parameters should have those names.
function(string, num) {
}
function("Hello", 5)
I’m passing the values for string
and num
to the function, the function can go ahead and use them.
Thanks for responding. It works!, it just doesn’t pass the test. In the instructions, it describes adding the sum of selected value to the total score, but from what I can tell, there is only a “score” variable that keeps track of the users score, and a “totalScoreElement” that is the html element that displays the score. So I added it in hopes of passing. I know the test is looking for a very specific answer, I’m just not sure what else to try/correct.
Just pay attention to exactly what the instructions ask, don’t try to second guess what else is needed.
- Make a function with the 2 given parameters.
-
add the user selected value to the score
-
update the total score text on the page
-
add a new li element
The instructions do not ask "create a new variable opt
and assign the value of the checked input etc.
Ahh, I understand, I was overthinking it. I just needed the parameters and not define or assign them, that is for the next step. I guess this part of the instructions : " 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." made it seem as if that were required for the current step. Solved. Thanks.
1 Like
It is a little vague, but you have to trust that the instructions give you all the information you need and no more. You get used to reading them in a certain way.
I find it helpful to boil the instructions down into clear bullet points.
1 Like