Hello! There’s a part where I am stuck. instruction says:
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.
### My Code
function pick(guess) {
let numbers = [];
while (numbers.length < 10) {
numbers.push(Math.floor(Math.random() * 11));
}
text.innerText = "You picked " + guess + "\n. Here are the random numbers: ";
}
I also tried :
text.innerText = "You picked " + guess + "\n" + ". Here are the random numbers: "
can anyone help me find what’s missing?
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 166
For anyone else who gets stuck on this, use any other browser other than Firefox.
I spent half an hour running around in circles over this. I don’t understand whats causing the issue, but doing the exact same answer in Chrome passes the solution. The correct answer is as follows: \n
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
Just as it was mentioned to the previous user who posted
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
I am not trying to share the solution but i am starting to think there is a bug, either the bug is my understanding of the instructions or in the code.
the instructions state : 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 am using Firefox if that matters . as a previous user has noted it seems to be an issue ?
my current solution is
text.innerText = “You picked " + guess +”.\nHere are the random numbers: “;
the way i understand it the period needs to be included with the guess and the new line should start at “Here”
i have also tried : text.innerText = “You picked " + guess +”.”+“\nHere are the random numbers: “;
as well as
text.innerText = “You picked " + guess +”.”+”\n"+"Here are the random numbers: ";
all with and without the space after numbers so i really must admit i am at a loss as to what i am doing wrong.
Please dont use other users topics for help with your own code. You should also read the instructions again carefully because your /n is not matching what the directions are asking for
If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.
The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.