Review Algorithmic Thinking by Building a Dice Game - Step 9

Tell us what’s happening:

what am i doing wrong? and what am i doing right? please help

Your code so far

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

/* file: styles.css */

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

// below is my problem
function updateScore(value, id) {
  const selectedValue = parseInt(value, id);
  score += selectedValue;


  totalScoreElement.textContent = score;

  // 4. Add new score entry to history
  
  const li = document.createElement('li');
  li.textContent = `${id} : ${value}`;
  scoreHistoryElement.appendChild(li);
}
 updateStats();

  





  



// 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/137.0.0.0 Safari/537.36 Edg/137.0.0.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 9

what is this doing? how many arguments does parseInt take?

check if the value of selectedValue is what you expect

it takes one argument and then number 10

the argument is value and then number 10

Are you sure parseInt() takes two arguments? Why don’t you search for it and check first?

https://www.w3schools.com/JSREF/jsref_parseint.asp

yes it takes two arguments

parseInt() For Beginners - DEV Community

While parseInt() can take two arguments, the second optional argument would be the radix, a number, like you said, that defaults to 10. But is that what id is here?

the second parameter will be passed the id value of the radio button, which is the type of score they achieved

i do not really know?

i think the answer is no?

Look at your HTML. What is the value of id in your radio buttons?

I do not understand your response. This is one of the radio buttons in your HTML:

<input type="radio" name="score-options" id="three-of-a-kind" value="three-of-a-kind" disabled />

Look at the value of the id attribute. That is not a number.

the value is to keep score

Is it a radix to indicate the base of the number system you’re working in?

This is what the second (optional) argument of parseInt() is. Read the documentation again

function updateScore(selectedValue, achieved) {

score = parseInt(selectedValue);;
totalScoreElement.textContent = score;

// 4. Add new score entry to history
scoreHistory.innerHTML= <li>${achieved} : ${selectedValue}</li>;

}

console.log(updateScore(10, “hi”));

i read so far ,you are right its optional and its true it indacates the base system 8-octa 2 - binary

so far the above was my code so far

And what else can you tell us?

Does your code pass the tests? Is there an error? What did you try?

Do you have further questions?