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

Tell us what’s happening:

Step 166

“At the end of the string, before the final quote, insert the new line escape character \n. This will cause the next part you add to text.innerText to appear on a new line.”

I’ve tried placing ‘\n’ in numerous location and nothing seems to work. I’ve switched from the Brave browser to Chrome. I’ve done additional research are the proper use of ‘/n’ and it seems pretty straight forward, so I have no idea how to get past this step. I also asked chatGPT and it suggested the code I have below.

Your code so far

text.innerText = "You picked " + guess + “.\nHere are the random numbers:”;

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.

  text.innerText = "You picked " + guess + ".\nHere are the random numbers:";

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 166

Take note of the instructions:
At the end of the string, before the final quote

I see. ‘/n’ isn’t breaking the two lines, it’s adding a break after the ‘:’.

1 Like