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

I don’t know what to use to replace [guess] with the player’s guess

### Your code so far

function pick(guess) {
  let numbers = [];
  while (numbers.length < 10) {
    numbers.push(Math.floor(Math.random() * 11));
  }
  text.innerText = "You picked " +  + "." + " 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/120.0.0.0 Safari/537.36

Challenge Information:

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

this is a syntax error, there is two + with no string
also, notice that you have the function argument you can use here, and it should be what the user picked

the player’s guess is meant to be in between the two + operator but i have no idea how to call the function i’ve tried plenty things this is one of them

text.innerText = "You picked " + guess.numbers.length < 10 + "." + " Here are the random numbers:";

i need a hint Please

you don’t need to call the function inside itself, you are building the pick function, and it has an argument, guess

see around in the code, it’s called like this

  pick(8);

I’m still lost can explain a little more clearer

the variable guess is the argument of the function, and its value is a number, the number picked by the user

Note - we aren’t allowed to write the code for you. It helps if you write some changes to your code and show us so we can go back and forth.

1 Like
text.innerText = "You picked " + numbers.push(Math.floor(Math.random() * 11)) + "." + " Here are the random numbers:";
text.innerText = "You picked " + numbers.length < 10 + "." + " Here are the random numbers:";

These are some of what i’ve tired am i on the right track or completely off

completely off.

You need to use the guess variable.

what about this or should i completely remove the numbers variable

text.innerText = "You picked " + guess.numbers.length < 10 + "." + " Here are the random numbers:";

the guess variable is already a number, you are making things more complicated than they need to be

i’m sorry about i’m so lost how about am i on the right track ?

text.innerText = "You picked " + pick(guess) + "." + " Here are the random numbers:";

you should not call the function inside itself, that’s recursion, and if you don’t know what it is, you don’t need it


just the guess variable

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

what should i do now?

the two literal strings with a + in the middle, merge them. You should have the + only twice

2 Likes

thank you very much the syntax really made me look like a fool i tried using just “guess”
before it didn’t run so i was just trying whatever i could. Thanks anyways i really appreciate you guys

2 Likes