Learn Intermediate Algorithmic Thinking by Building a Dice Game - Step 59

My code do not pass.

Step 59

If the user makes a selection, then the rounds, rolls and scores 
should be updated.

Add an if statement, to check if selectedValue is truthy. 
If so, reassign the number 0 to rolls and increment round by 1.

Then, call the updateStats and resetRadioOption functions.
 And lastly, call the updateScore function and 
pass in selectedValue and achieved for the arguments.

Now you should be able to roll the dice,
 make a selection keep a score and have the score 
display under the score history.

My code is :

if (selectedValue) {
  rolls = 0;
  round += 1;
  updateStats();
  updateScore(selectedValue, achieved);
} 

The following error text appears in the console:

// running tests
You should increment  round by  1
You should call the  updateStats
and resetRadioOption
functions.  
You should call the   updateScore function and pass in
selectedValue  and  achieved  for arguments.

// tests completed

I can not find any errors in my code,
How can I continue?

You appear to be missing a resetRadioOption function call.

I added the function resetRadioOption , stll I get the error massage:

You should increment round by 1.

My code is :

if (selectedValue) {
  rolls = 0;
  round += 1;
  updateStats();
  resetRadioOption();
  updateScore(selectedValue, achieved);
}

I think that my code is a correct one.
Why this error message?

At last I found the solution of this problem of mine.
What error:

You should increment round by 1.

is that I should use The increment (++) operator increments (adds one to) its operand . So when I did change the line

round += 1;

to this line

round++;

test did not fail any more.

1 Like