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

Tell us what’s happening:

" Step 173

Inside the if expression, add the string Right! You win 20 gold! to the end of text.innerText. Also, add 20 to the value of gold and update the goldText.innerText."

Oddly having trouble with this one since this is very straightforward at this stage. Am i going nuts???

### Your code so far

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

There’s not needed space at the start of string added to text.innerText.

1 Like

Wow, thanks for the help!! I have it in my head that whenever I need to add a string to the end of text, the string begins with a space. Need to wrap my head around that. Thank again.

2 Likes

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