Learn Basic JavaScript by Building a Role Playing Game - Step 173

am getting the same error again n again You should use compound assignment to add the string Right! You win 20 gold! to the end of text.innerText .

### Your code so far

if (numbers.indexOf(guess) !== -1) {
     text.innerText += " Right! You win 20 gold! ";
     gold += 20;
     goldText.innerText = gold;
  }

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn Basic JavaScript by Building a Role Playing Game - Step 173

You have spaces before and after the text, experiment with removing it.

add the string Right! You win 20 gold! to the end

1 Like

thanks it worked but when there were other places where when using compound assignment had to add spaces

1 Like

True it does depend on the case. Maybe here the previous text ended with \n

oh btw thanks for the help

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.