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

Tell us what’s happening:

I cant understand why my code keeps generating error. please explain

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

function pick(guess) {
  const numbers = [];
  while (numbers.length < 10) {
    numbers.push(Math.floor(Math.random() * 11));
  }
  text.innerText = "You picked \n" + guess +". Here are the random numbers: \n";
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

Challenge Information:

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

Please talk to us about how the instructions or error message is confusing. Thanks

We don’t know what kind of error it is. We don’t have a lot to go.

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

here is the error;
Sorry, your code does not pass. Try again.

You should add the new line escape character \n to your ". Here are the random numbers: " string.

Can you please talk to us about how the instructions or error message is confusing. Thanks

I have added the new line escape character as per the instructions but the error is still there.

Did it ask you to add it anywhere else, or only there?

This is my code right no;

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

i have added the \n exactly where its asking me to add.

You added an extra space to the string

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