Review Algorithmic Thinking by Building a Dice Game - Step 9

Tell us what’s happening:

My code has passed the test but I am confused. When I console log selectedValue it returns 10 five times. I don’t understand why and I don’t even understand where selectedValue is defined. I feel like I’m missing something fundamental and maybe need to start this entire course over.

Your code so far

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

/* file: styles.css */

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

const updateScore = (selectedValue, achieved) => {
  score += parseInt(selectedValue);
  totalScoreElement.textContent = score;
  scoreHistory.innerHTML = `<li>${achieved} : ${selectedValue}</li>`;
  console.log(selectedValue);}

// 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/127.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 9

Here is the line that defines selectedValue.

Every time you call updateScore, the log will be printed. (The check button runs a script that calls the function that many times)

Okay, but why does it log the number 10? Which obviously is not an option in this dice game.

Because the testcase is calling it with that number.