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

Tell us what’s happening:

I have attached the screenshot with this, when the output is correct then why is it keeping me stuck on this step? what’s wrong with my code?

Your code so far

text.innerText += "You attack it with your " + weapons[currentWeapon].name + "." ;

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 120

1 Like

Because you are concatenating the new string onto the previous string you have to have a space at the start of the string.

3 Likes

Thank you so very much!
Sorry if that’s too silly ,I’m new to coding.

1 Like

Not at all silly.

It is more an issue with the challenge. The text inside the code element has a space at the start of the string, but the space doesn’t show up.

Single backtick code block (has a space you can’t see)

You attack it with your <weapon>.

Three backticks code block (has a space you can see)

 You attack it with your <weapon>.

I made an issue for it.

1 Like

Thank you. This was helpful to include in the thinking process. It never occurred to me.

1 Like