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

Tell us what’s happening:

Your code so far

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

if (numbers.includes(guess)) {
    text.innerText += ' Right! You win 20 gold!';
    gold +=20;
     goldText.innerText =gold;
  }

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) 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 171

It looks like parts of your code were cut off.

Can you post all of your code for us so we can better assist you?

Your code should be inside the if statement

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

i have updated the code and this is the warning i am getting " You should use compound assignment to add the string Right! You win 20 gold! to the end of text.innerText ."

The test is failing because of this space you added here

remove it and it will pass.

it looks like you don’t need that extra space because earlier, you were adding a newline to the text

  for (let i = 0; i < 10; i++) {
    text.innerText += numbers[i] + "\n";
  }

it worked, thank you