# Review Algorithmic Thinking by Building a Dice Game - Step 9

### Tell us what’s happening:

My updateScore function should convert string value to integer and add the value to the total score which is what I thought (score += Number(selectedValue) would do but its still incorrect. selectedValue is a str so number should convert it to integer and score is an already existing numerical global variable and i want to add the selectedValue to already existing score value

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

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

const updateScore = (selectedValue, achieved) => {
score += Number(selectedValue);
totalScore.textContent = score;

scoreHistory.innerHTML = `<li>\${achieved} : \${selectedValue}</li>`;
}

// User Editable Region
``````
``````/* file: styles.css */

``````

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36`

### Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 9

`Number()` accepts only “digit strings”. For example: “34”, “-56”, “3.14”, “6.022e23”, etc. are all valid for `Number()` While, `parseInt()` accepts those strings which may or may not have non-digit character(s) at the end of string. For example: “34”, “34foo” and “34bar34” will all return the number 34.

In this case use `parseInt`

Unfortunately it is still not working. Ive have tried both parseInt(selectedValue), and parseInt(selectedValue, 10) .
Thank you for your help on this! I’ve been staring at it for a while haha!

still giving me this message: " Your `updateScore` function should convert string value to integer and add the value to the total score."

Hey @katmoria13,

1 Like
``````const updateScore = (selectedValue, achieved) => {
score += parseInt(selectedValue);
totalScore.textContent = score;

scoreHistory.innerHTML = `<li>\${achieved} : \${selectedValue}</li>`;
}
``````

Here are the exact directions:
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.`Preformatted text`

oh I figured it out…parseInt worked but i had accidentally erased “Element” from totalScoreElement
thank you for your help with the parseInt!