Review Algorithmic Thinking by Building a Dice Game - Step 9

Tell us what’s happening:

i could not understand whats the problem, system warning is “your updatescore func should convert string value to integer and add the value to the total score”

Your code so far

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

/* file: styles.css */

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

};

const updateScore = (value, id) => {

  let selectedValue = parseInt(value);
  let achieved = id;

  totalScoreElement.innerText += `${parseInt(totalScoreElement.innerText)} + ${selectedValue} `;
  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/128.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 9

Hi, @yagizalanli

I can see 2 issues in your code that are likely the problem.

The first is how you’re using template literals, these things ${}

Each template literal is an isolated bit of code, and the result is stringified.

Sum is ${5} + ${5} will give you “Sum is 5 + 5”
The 2 fives are just stringified, and the plus sign is also just part of the string.

However,
Sum is ${5 + 5} will give you “Sum is 10”
The 5s are still numbers inside the template literal, so they are added to 10 before they become part of the string.

The next issue is how you are setting the total here:
totalScoreElement.innerText +=
.innerText is a string.
Consider what += and = mean when dealing with strings.

Let me know if this helps or you need more hints.