Tell us what’s happening:
Hi guys,
I am at one of the final steps of this project and got really stuck with the ask.
Basically, based on this code
I need to: " 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.
Your code so far
I have tried multiple options and nothing is working. So by now I am not sure if I cannot get it right, if the instructions are wrong or if there is a bug. Here is everything I tried so far:
text.innerText = "You picked " + guess + ".Here are the random numbers: \n";
text.innerText = "You picked " + guess + "\n.Here are the random numbers: ";
text.innerText = "You picked " + guess + "\n .Here are the random numbers: ";
text.innerText = "You picked " + guess + ".\n Here are the random numbers: ";
text.innerText = "You picked " + guess + \n".Here are the random numbers: ";
text.innerText = "You picked " + guess + "\n" + ."Here are the random numbers:";
And a few more combinations, but this is just to give you an idea. I honestly dont know what else to try.
I appreciate your help and support
function pick(guess) {
const numbers = [];
while (numbers.length < 10) {
numbers.push(Math.floor(Math.random() * 11));
}
text.innerText = "You picked " + guess + "\n" + ."Here are the random numbers:";
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 164